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.