Drupal: How To Add A Tab To A Views Page

I finally decided to spend a few minutes and re-familiarize myself with Drupal Views.  I hadn’t used the Views module since upgrading to to Drupal 6 last year when all of my views got blown away and I wanted to start rebuilding the views I had previously created.  I had been putting it off because I was accustomed to using the old version of Views, and everything looked much different in the newer Views 2.x version.

The first custom view I had previously and wanted to re-create was on the tracker-page that lists what pages have been created and commented on recently.  It was trivial to add a few fields and move things around, and I assumed it would be just as easy to add an additional tab-page.  After messing with the View-tab settings for an hour and Google-bating with myself until my hands were chapped, I finally came across an old post at Drupal.org that sort-of explained the steps necessary to create an additional tab-page on a Views page.  Since how to add a tab to Views page isn’t really documented (or, if it is, it’s not easy to find) I wanted to post it here to save anyone else the pain and frustration I went thru assuming they’ll stumble across this post while madly Googling for info the same way I was.

How to add a tab to a Drupal Views page:

On the View that you want as the default tab: In the Views ‘page settings’, set the Menu Type as ‘Default Menu Tab’ then click the little setting ‘gear’ and set the ‘parent menu item’ to ‘normal menu item’.  Set the path as “/something/tab1″; for example, “/postlist/allposts”

On the View that you want as your second (or 3rd, etc) tab, set the Menu Item Type as ‘Menu tab’.  Set the path as “/something/tab2″ for example, “/postlist/newposts”

The key to making the tabs show on the View page in Drupal is the path setting!  All of the pages must have the same parent-path – in the examples above this is “/postlist”.  If the parent-paths are not the same, you will never get that damn tab to show up in the View.

Another note to avoid frustration:

If you are customizing your default Tracker page with Views, you must either use a different path-name (ie; NOT “tracker”) OR, you must disable the Drupal core ‘tracker’ module.  Otherwise you will get “page not found” errors on your custom tracker page, or when clicking the “my posts” tab.

If you stumbled across this post via Google, I hope I saved you some time and frustration.  If I did, please take a second to post a comment and say thanks.

Drupal: How To Add A Tab To A Views Page by
  • patrick.frickel

    Thanks soo much and I learnt a new word google-bating…could give a master class in this :)

  • http://nybergbusinesssystems.com Darryn

    Google found this post. You answered what I have never know how do do in over 14 drupal installations. THANK YOU!!!!!!!!!!

  • ben

    Thank you very much. I found this page by google and it was perfect. It was exactly what I needed. thank you so much.

  • mark


  • http://www.giovannitufo.com Giovanni

    Great post! It’s a hidden feature of drupal, but a great and useful one!

  • Raf

    great! Any idea where we can theme these tabs?

  • http://growingventuresolutions.com lisarex

    Hey, thanks for this! I also was struggling with the tabs and this in particular solved it

    lisarex said:

    The key to making the tabs show on the View page is the path setting! All of the pages must have the same parent-path – in the examples above this is “/postlist”. If the parent-paths are not the same, you will never get that damn tab to show up in the View.

    Do you happen to know the URL of the docs page on drupal.org that wasn’t adequate? Docs are maintained by everyone, all volunteers. So if you wanted to incorporate these improvements, that would make the Docs contributors (including me) really happy :)

  • http://www.dhtmlextreme.net Anthony Ogundipe

    Thanks a lot pal. Merci! Muchas gracias amigo. It was really helpful. I have been searching for this for months and have read countless drupal documents.

  • Pooya

    awessssome.. thanks a lot for this saved the daay

  • Dave

    Thanks for this, saved my ass.

  • Mauro

    Hey man! THANKS A LOT!!! I was going insane to make those tabs appear on my views page… This is a huge documentation problem of drupal website :S

    Cheers from Brazil!

  • leon

    absolutely brilliant. perfectly explained. thanks a million.

  • fmt

    Thanks a million! just what i was looking for. Why don’t you add this to drupal views-tab documentation. First i searched there and then googled. So that would help others i guess.

    But implementing this, now another problem arose. I couldn’t deep link tabs inside tabs :-( I have couple of views. I made the paths like

    hoping this would create Good and Bad tabs and within each more tabs 1st, 2nd etc.

  • Ramu

    Thanks a lot!!! I was searching for this and I had thought it would require some new module for this! This really helped me out, and it was well explained too.

    Im planning to limit access to these tabs by user role, now, would you have some tips for that?

    • http://www.facebook.com/thegrownupgeek Rand Wilson

      Limiting access to a tab by user role is a built-in function! On the tab’s “Basic” settings, find “Access” and click the little settings-gear to the right, and select your roles.. Easy peasy!

      • Ramu

        YAY!!! Thats super! I was thinking I’ll have to create multiple views. Thanks a ton, you saved me a lot of trouble!

        Im not on my machine right now, I cant wait to check this out!

  • Mitesh

    you say “If the parent-paths are not the same, you will never get that damn tab to show up in the View”. Is there any way to get menu tab if the parent tab is not same?

  • wiz

    Thank you for this tutorial, found it via a link on drupal.org. Very helpful.

  • gigi

    Great, thank you! I found your article on a Drupal.org discussion :)

  • Tanmay

    Really a useful post…!! Thanks a lot… :-)

  • http://www.wash-gop.com/NewSiteV6V3 Wyckham Seelig

    Do you have to have a separate View for each tabbed page?? When I go into views, and click the “settings” gear, I can only set one path and one tab menu setting for each view???

    • cass

      No. You can create multiple pages in the same View and assign each page to a tab. This can be handy if the pages are very similar or share attachments. Give each page a path (foo/bar/page1, foo/bar/page2, etc.), a Menu Tab name, and set a priority if you want to control the order in which they appear.

  • http://cafetruth.com kevin marshall

    FINALLY! A clear answer!

  • Lop

    Thanks, it really help me

  • http://twitter.com/razkovnik Dimiter Ivanov

    Thank you, very helpful post!

  • Bruce T

    Great post saved me a lot of time digging about on the internet for the answer to this one

  • Thomas CARTER

    Great post ! Thanks.

  • Gamsto8

    Thanks a million!!!!

  • drew

    3 years later, and this is still so helpful. Thanks!

  • Ashley

    Is there a way to change the order of the tabs when they are created using views?

  • Aischle

    Great info, thanks!

  • Skyhawk

    Thanks for this! I couldn’t find how to do this anywhere else.

  • David Bätge

    you, sir, saved my day!

  • Heather

    Thank you, thank you, thank you! I was struggling with this problem for hours yesterday. This fixed it! I am so relieved. :)

  • ForecastCity

    Thank you!

  • Alex

    Thank you sir! The detailed advice is much appreciated.

  • J-P Stacey

    Brilliant: worked like a charm. Thanks!