I'm trying to do a very simple page/argument setup with Views2. I am sure it is not very complicated, but there are so many options and variables! I can't seem to get it to work.
What I have:
1 taxonomy vocab with 5 terms ("branding", "web design", etc)
Many entries of the type "Portfolio", each one tagged with one (only 1) of the above terms
What I want:
When a user goes to "/portfolio/branding", they see the most recent entry in branding. If they go to "/portfolio/web-design", they see the most recent web design entry.
I could just make 5 different page views for the 5 terms, but I thought it would be snazzier (and more useful for the future) to use arguments. But there are so many choices! Can you give me a recipe?
Thanks!
Comments
Your view would have the path
Your view would have the path set to 'portfolio'.
Add an argument for "Taxonomy: Term ID".
Set "Validator" to "Taxonomy term"
Set "Vocabularies" to the vocabulary you are using.
Set "Argument type" to "Term name/synonym converted to Term ID" (This assumes you are passing the taxonomy name as the argument)
Ah! Perfect, thank you!! Why
Ah! Perfect, thank you!!
Why is it that I'm using Term ID (with the argument converted from the name) instead of Term Name? I mean, I get why it works, but in what situations would I use Term Name instead?
EDIT: Oh, I see, Views tells me it is more efficient this way!
Ah... I've never understood
Ah... I've never understood what arguments were supposed to do.
Thanks for the understandable example - I'm one step closer.
What would be the advantage of this over using an exposed filter dropdown for the vocabulary?
Or simply aliasing the taxonomy url? eg. /taxonomy/term/12 --> /portfolio/branding
Cheers.
Re: What would be the
Re: What would be the advantage of this over using an exposed filter dropdown for the vocabulary?
Different use cases, the argument applies to path and is something a user gets to following a link.
Exposed filters let users filter/restrict the result set of a more general view.
Re: Or simply aliasing the taxonomy url? eg. /taxonomy/term/12 --> /portfolio/branding
Simply aliasing a taxonomy path is easier and with pathauto takes no real effort.
Views is useful in this context if you want a different listing than the standard one
taxonomy/term/{tid} gives you. Note that views can override the standard taxonomy/term
path so you can actually both alias the path and have views produce the list.
Thanks for the
Thanks for the explanation.
This has taken me quite a bit forward in my conceptual understanding of View's arguments.
I might actually have another stab at using them.
One more question (it's your own fault, since you're so good at explaining!):
In the help it says that arguments aren't always urls, and not to fall off our chairs in shock
when we see an argument that isn't. Any idea what it's talking about? How else could
a parameter be passed to an argument, if not in a url? Last question, I promise.
Cheers.
I have not played with this
I have not played with this enough to know the answer, that said I can give an example.
If you create a view with an argument of type "Taxonomy: Term ID (with depth)", you will also get an argument of type "Taxonomy: Term ID depth modifier". It is not from an argument in the path and while you can add it separately it has no settings of it's own. You can also remove it, though I have not tried and for all I know the world will end if one does :).
So given the example, we have an argument ("Taxonomy: Term ID depth modifier") the modifies the behavior of another argument ("Taxonomy: Term ID (with depth)") and it value/control comes not from a path argument but a setting in the other arguments options. There may be other examples but it is not one I have run across.
Thank you. Again,
Thank you. Again, enlightening.
All this info has added lots of extra perspective to Views.
Cheers.