How do you use a view with arguments as the site front page in Drupal?
Posted
by
Justin
on Stack Overflow
See other posts from Stack Overflow
or by Justin
Published on 2011-01-06T02:03:12Z
Indexed on
2011/01/06
2:54 UTC
Read the original article
Hit count: 180
I have a Drupal site and I have setup a view to power the front page.
My goal is to be able to pass 0-2 arguments to the home page, that get passed into the view. However, I still need the normal Drupal pages to work. The list of arguments is known.
For example:
- mysite.com/berlin/birds would pass in "berlin" as the first argument and "birds" as the second argument to the view that powers the front page.
- mysite.com/berlin would just pass in one argument, "berlin"
- mysite.com/admin would load the normal admin pages in Drupal
I'm not clear on how to achieve this. Is there a hook I can use? I can't find one or think of one. Is there a way to specify this in the argument for the view itself? Perhaps I can write a hook that interjects when the URL is being loaded, and rewrite in the background?
The solution I currently have is to add these paths (since my arguments are known) to the menu system. This works, except that when I the pages they aren't the front page, so the pages don't use the node themes I want (they use the node details theme).
© Stack Overflow or respective owner