Hi,
I did quite a bit of search about this but couldn't find the answer yet.
This is what I'm trying to achieve --
I have created a "view" that displays a list of nodes. I have "argument" set to "taxonomy: term"
and embedded the "view" in my page.tpl.php. I thought it should list nodes that is related to term "hotels" when I do this www.example.com/hotels. However, it displays everything.
I'm trying to have
www.example.com/hotels <= the "views" display nodes that are associated with term "hotels"
www.example.com/vacations <= the "views" display nodes associated "vacations"
Those terms are taxonomy terms
Do I need to insert a php code in the "views" to achieve this? or plain with "arguments" and "relationship" will do the trick?
One more question, is possible to have "views" display with offset = 10? It means the list will starts with 11th node instead of the 1st one.
thanks
Comments
When embedding your view you
When embedding your view you have to pass the argument programmatically:
Where arg(0) is the first component of the Drupal path (e.g., 'hotels' in your example).
Hope this helps!
-= Gerrit Brands
thanks, but it's still
thanks, but it's still returning the enter list of the nodes.
this is what I have
how do I debug it? for example, list all the arrays and etc
thanks
Perhaps your view takes the
Perhaps your view takes the taxonomy term id as an argument rather than the term itself? When you're building your view have you tested this functionality in the preview area? If it works in the preview area and not when embedded then there might be something else going on.
-= Gerrit Brands
Hi, I got it working.
Hi,
I got it working. Instead using arg(0), I have to use arg(2). :)
it's great! Thanks
one more question, how do I insert a different "views" when the actual node is displayed?
For this one, when I do www.example.com/hotels, it will show a list of "hotels".
I inserted in page.tpl.php
Now, I would like to display www.example.com/hotels/boston to show just boston's hotel lists.
where do I insert the "views" to? Do I need to create a new node page?
thanks
You should be able to use the
You should be able to use the same view, just passing different arguments. You would then have two arguments for your view, 1) hotels & 2) city.
For the second argument, you would adjust the settings to show all if the argument is not present. However, when the second argument IS passed, it will limit the result set to just the hotels in the passed city.
So if arg(2) got the first one working for you, your new setup might look something like this:
Hope this helps!
-= Gerrit Brands
Hi, I tried your
Hi,
I tried your suggestion. However, www.example.com/hotels/boston won't list the view.
I did play with arg numbers, but no success.
Is there something I need to setup under "arguments" -> taxonomy: parent term? Because this is what I have "taxonomy: parent term".
thanks for the helps
You'll have to add another
You'll have to add another argument to the view to accept the city term.
-= Gerrit Brands
thanks. I tried to put add
thanks.
I tried to put add another "arguments". Tried to add another taxonomy: parent term but it didn't' work.
Tried also adding a taxonomy: term, and it didn't work.
again thank for the helps