I have a view set up to accept 2 arguments. The url is like this: playlists/video5/%/%/rss.xml
It works fine if I supply the url with 2 arguments like playlists/video5/front/coach/rss.xml.
I have 2 arguments of “Taxonomy: Term”
But I need it to run even if 1 or no arguments are supplied. It looks like you can do this with PHP Code under: Provide default argument options -> Default argument type: -> PHP Code.
I’m using this for the first one:
$arg[0] == 'all';
return 'all';
I’m using this for the second one:
$arg[1] == 'all';
return 'all';
It’s working fine in the preview if I enter 1, 2 or no arguments, but in the browser it giving me a “Page not found” error if I use less than 2 arguments in the url.
It woks with these urls:
/playlists/video5/gridiron/all/rss.xml
/playlists/video5/gridiron/football/rss.xml
It does not work with this:
playlists/video5/gridiron/rss.xml
I want it to return all values when no arguments are given, or if only one arg is given, just use the one, etc…
thanks
I would rearrange your URL to look like this:
playlists/video5/rss/%/%so that way your arguments always come last. Then in your argument settings set:Action to take if argument is not present: Display all values
This way when you go to
playlists/video5/rssyou will get every value. When you go to/playlists/video5/rss/term1you will get all values that haveterm1in them. Then the trick for the second argument is to include the wildcard for first argument like this:/playlists/video5/rss/all/term2. I believe that will include just the values that have the second term.Alternatively, if these are both taxonomy terms, you may want to consolidate these into a single argument and check the box that says:
Allow multiple terms per argument.According to the documentation right below the checkbox, it looks like this should allow you something likeplaylists/video5/rss/term1+term2and display all values that have the first or second term.