I'm trying to display two views as tabs on a specific node of my site. After some hours my head hurts and I still could not figure out how to to it.

These are the steps I took:

  1. Created node page. Path alias: foo
  2. Created page display on view. Menu as normal (not default) tab, path: foo/view1
  3. Created another page display on same view. Menu as normal tab, path: foo/view2

However, when I go to foo there' s no tab other than the standard "View" and "Edit". If I go to foo/view1 or foo/view2 directly, I can see the view results, but also no tabs.

Isn't the steps above supposed to do the task?

A also tried to alias foo to foo/view to no avail — and with this change, when I go to foo I get a 404.

Am I missing something?

Comments

Cybergarou’s picture

Tabs are added based on the actual path, not the alias path. To add the tabs to a specific node the path must be in the form of node/#/view1 were # is the desired node.

You will also need to make an alias for each tab you are adding or install the Sub-path URL Aliases module.

flaviovs’s picture

Thanks for the reply.

Already tested this.

Did the test again, just in case:

  1. Removed "foo" alias -- node now is on "node/45"
  2. Set view path to "node/45/view1"
  3. Go to "node/45" ⇒ can see node, but no additional view tab
  4. Go go "node/45/view1" ⇒ view displays, but no tabs

Does it work for you?

Cybergarou’s picture

Sorry, I forgot something important. Even if you only want the tab on one node, you style have to construct the path using an argument or the system doesn't put it in the node.

Try using node/%/view1 for the path. You will have to add an argument. It doesn't matter what the argument is, but let's use Node: Nid.

Change the following settings for the new argument.

Action to take if argument is not present: Hide view / Page not found (404)

Validator: PHP Code

PHP validate code:

if($argument == 45){
  return TRUE;
}

Everything else should be ok. This should give you a tab that only shows up on node 45.

flaviovs’s picture

Many thanks, Cybergarou.

It's working perfectly now!