I'd like to suggest a new feature for a future version of Views: the ability for multiple views to have the same path for their page displays, with the capability for Views to determine which view the path is referring to based on arguments (the determination part would, presumably, be PHP code entered by the administrator, ala argument validation in Views 2).

For example, two views that both have the page display path "cars/%". If the URL "root/cars/1968" is accessed, Views runs some (admin-specified) code, determines that the argument is numeric, and displays the view "cars_from_a_certain_year". On the other hand, if the URL "root/cars/Lotus" is accessed, Views runs some code, determines that the argument is non-numeric, and displays the view "cars_made_by_a_specific_company". Both of these views, "cars_from_a_certain_year" and "cars_made_by_a_specific_company", would have the same page display path ("cars/%").

I think this could be beneficial, since it more closely mimics how pages might be laid out in an actual directory structure and shortens paths for page displays.


merlinofchaos’s picture

Currently multiple displays with the same view can have the same path (and FYI it will never be multiple views, it will only ever be multiple displays within the same view; this is due to complexity in the menu system) though right now only access is checked, not argument validation. I agree that argument validation should also be checked, but it's not an easy task unfortunately.

william_frane’s picture

Multiple displays of the same view with the same path would be just as useful. I've done some tests and currently it seems that if there are multiple displays (of the same view) with the same path the first display in the view to use the path is the only one that's ever shown when the path is accessed (so it's the same sort of limitation). If I'm missing something regarding the current functionality in this area (e.g. multiple displays with the same path can act in a manner similar to the hypothetical "cars/%" case I outlined above) I'd really appreciate any enlightenment.

merlinofchaos’s picture

As I mentioned, it checks access. So if the current user doesn't have access to the view, (i.e, doesn't have the required role/permission) then it will check the next one.

Arguments are another story. Still need to work on that.

KarenS’s picture

@william_frane - depending on what you're trying to accomplish, you may want to use attachments for this. You can create a view page at your given url and a series of attachments to that view for the various ways you want to display things. Then you'd need some custom code somewhere to hide/show the attachments based on your criteria. I'm not sure exactly how you'd do that - just giving you an idea to play with.

william_frane’s picture

KarenS, what do you mean by "attachments" in this context? (I assume you're not referring to file attachments.)

Jeffdo’s picture


Attachment displays are 'attached' to another display in the same view. When the display is visited, the attached display will also be rendered and may be placed before, after or both before and after the original display. Attachment displays are often useful for displaying an argument summary view along with a page display that accepts arguments. This can be used to provide a kind of glossary.

[Views 2] Can have views within views, known as attachments. These attachments can be used to display multiple, related views within the same space.

The first quote's from the advanced help (/drupal/help/views/display-attachment), the second's from the announcement (http://drupal.org/node/277856) for the D6 Views 2, CCK 2, and Organic Groups release candidates.

The View Reference module came out July 1, the day before the release candidates, with similar functionality.

Dave.Ingram’s picture

I also find myself with a need for this functionality. A site I'm currently working on has different displays based on the depth of taxonomy terms. The problem is that the path is always taxonomy/term/tid, no matter how deep it goes, so I would need another way to choose the display besides path. In this case it would be by checking the term_parent and/or children in an argument.


abu3abdalla’s picture

i think its not so hard , i am not developer but i think if we add visibility function for the page .

merlinofchaos’s picture

i think its not so hard , i am not developer

Not helpful.

abu3abdalla’s picture

i have made that but not as i said :)

my problem is : i have multi vocab and i need certain view page for every vocab. i mean taxonomy.

lets say for the first vocab taxonomies i need it node type and for the second vocab taxonomies i need it fields with certain fields.

i have solve it by my idea and i will write a tutorial for that but after i test my approce.


federico’s picture

abu3abdalla could you share your solution?

I have also two vocabs,
- for vocab1 I want to use view1 (page display - path: "taxonomy/term/%" - filter: vocab1)
- for vocab2 I want to use view2 (page display - path: "taxonomy/term/%" - filter: vocab2)

When I visit a vocab2 taxonomy page: http://example.com/vocab2/taxonomy/term/% , view1 comes to action first and filters the nodes, so (in my case) i get an empty view.

If I visit http://example.com/vocab1/taxonomy/term/% , view1 works fine

If I delete view1 and visit http://example.com/vocab2/taxonomy/term/% , view2 works fine.

I'll appreciate your help.


federico’s picture

duplicated comment, sorry

pjsz’s picture

like federico, #11, i need the same thing -- many different taxonomy views filtered by node type, vocabulary and what ever else but still use the path /taxonomy/term/%. I'm using Views 2 in D6. I used the "taxonomy/term/%" path so that I could make URL Aliases for them and my term links rendered under all my nodes by the taxonomy module automatically are aliased like "products/learner_assessment" rather than "taxonomy/term/%". That is handy. But not having any of your new taxonomy links work is not good.

This hit me like a bombshell. So as it stands, the first view you make with a path "taxonomy/term/%" ( or any path ) is what will be called if the user has permission. Otherwise it will look for another view the user has permissions to use and the first one hit, is what is rendered. Is that correct for Views 2? I can see this is a tricky problem. What should views do? I don't know. Maybe the Views2 could check the filters and see if there a a vocab filter on the view then if the term is not in the vocab it tries the next view.

Did anyone figure out a good work around? I think i need to find a better way to alias my taxonomy links. But the problem is , i need my taxonomy views filtered differently for different vocabs so they have to go to different views. Maybe a taxonomy redirect -- /taxonomy/term/% would check which vocab and then change path to get to the proper view page. I guess i just need to override the code that is generating the term links and check the vocab type and rewrite them to the path to the correct view. That could work . Anyone else have any better ideas? It sure would be nice if views checked taxonomy vocab filter first. That would go a long way and sounds easy enough. I may try a patch for that first.


merlinofchaos’s picture

Status: Active » Closed (won't fix)

What people want isn't really something Views is meant to do, and is actually really an effect of taxonomy trying to do a little too much with not enough. Views itself is never going to give you multiple views for different taxonomies.

That said, you can accomplish that task using taxonomy redirect or Panels 3 which is currently in an early (somewhat buggy) beta.

ulo’s picture

I also need to have different Pages for different Vocabularies.
The path for all of them is "taxonomy/term/%".
As argument i use the Taxonomy-TermID with a Taxonomy-Term-Validator where I am able to select the desired vocabulary. But that does not work as expected...

It would be nice if Views would allow for an "Action if argument is not valid" like "try next page" or so (instead of show all or nothing).

alienzed’s picture

choosing the display based on arguments would be great! that way we could allow users to choose how many items per page they want to see without having to embed the view! if there's another way to do that, I'd love to know :)

calbasi’s picture

Taxonomy redirect rules !! to bypass this issue :-)

Thanks a lot

JGO’s picture

Any solution for this yet? I'm having the same problem with content taxonomy terms view :s


Found out that it can be done when using the attachments display.
Create an attachments display with these settings:

Attachment settings
Inherit arguments: Yes
Inherit exposed filters: No
Inherit pager: --> not important
Render pager: --> not important
Position: After
Attach to: Page

Than overide the arguments (and also filters if required) for this attachments display.
Also make sure that when arguments do not validate you chose: "display empty text"

Hopefully this is useful for someone!

JGO | http://www.e2s.be

bonus’s picture

Arguments are another story. Still need to work on that.

Would be useful. Subscribing.

caschbre’s picture

I tried JGO's solution in post #18 but I couldn't get it working for my scenario. Maybe that's because I'm not basing my views off of taxonomy. Here's my use-case that hopefully shows how two displays with the same path but different arguments would come in handy.

Use Case
Content Types
- Game (plain old content type)
- Team (group type)
- News (node reference for news about a Game; also may be posted to a Team group)

- News about a game
--- path: node/%/discuss (argument = node reference field)
- News posted to a team group
--- path: node/%/discuss (argument = group nid)

My initial thoughts to choose which display to present would be...

pseudo logic

$displays = get_displays($path);

foreach ($displays as $display) {
  $display_arguments = get_display_arguments($display);

  if ($available_arguments->type == $display_arguments->type) {
    return $display;

I know that's very basic, but it basically finds all available displays based on the path and then checks those displays for the type of arguments it accepts. If those arguments are available then use that display.

kla2t’s picture


tobykilroy’s picture

Thanks JGO that worked perfectly for me!

candelas’s picture

@JGO you are a crack!
i was making things very complicated and your solution worked perfect and it is simple!!! :)
i think it is so good, that i put it in the documentation

HansKuiters’s picture

JGO: thanks for the solution, but I can't get it to work.

I have a view with a page display and an attachment display, set up like you described.

In the page display I have one argument Taxonomy: term ID (with depth) with Basic Validation, a couple of fields , no filters.

In the attachment display I have one argument Taxonomy: term ID (with depth) and one argument Taxonomie: Term ID depth modifier, Validator Taxonomy term with the wanted Vocab checked, Action to take if argument does not validate set to Display empty text, Filter set to one Node type.

When viewing terms from vocab A and vocab B, they both show nodes from all node types. Can you help me out here?

JGO’s picture


I would assume that you don't hide it in one of the 2 cases ?
In both cases it should hide nodes when it's a view where they are not wanted.

pupp’s picture

The solution has worked for me, initially. I'll need to continue to play around with this a bit more as my requirements may get more complex. just as an fyi, my setup consists of both a store front and a blog. uc_catalog was simply not cutting it so i had to go on my own and build my displays with views 2. thanks for the help @JGO

GiorgosK’s picture

if anybody is still struggling on this problem try any of the following projects