Creating Tabbed Views in Drupal 6

As a Drupal newbie, I am always confused with its simple mechanisms, such as routing and menus. I just spent about an hour figuring out how to create a view with tabs that lead to more specific lists of data, for example, in 'document' page there are three tabs, one is 'all' which is the default display listing all contents, one is 'homework' leading to a path 'document/homework', and the last one is 'report' leading to 'document/report'.

'document' page
- tab 'all' -> 'document/all'
- tab 'homework' -> 'document/homework'
- tab 'report' -> 'document/report'

After 30 minutes of googling, I found this (and yelled 'Eureka'), Tutorial #3: Create two tabs to sort taxonomy view alphabetically and by created time. The method is quite simple but Drupal gave me no clues or I made a poor search (or I was so n00b that I didn't know these things before).

Well, the way is:

  1. Create a view.
  2. Name the path (url) to be what you want the default tab to be, for example, 'document/all'.
  3. Configure your view with sorting, filtering, etc.
  4. Choose 'Default menu tab' in Menu option and name it.
  5. Choose 'Normal menu item' to be the parent, since this tab is linked directly from a menu, i.e. 'document'
  6. Finish this first tab.
  7. Create another display.
  8. Name the path of this one as a tab option, like 'document/homework'.
  9. Configure it.
  10. Choose 'Menu tab' for this one.
  11. Finish this tab.
  12. Repeat (8) - (11) for more tabs.

That's it. Simple, huh?
Please leave a comment if there's any mistake above.

18 comments

peach wrote 3 years 2 weeks ago

i sent the email to you laew naka

metriebarty wrote 2 years 25 weeks ago

opithToop
Bfpg
Twerndarmaria
Bwbd

Sean wrote 2 years 19 weeks ago

I was a little confused about Drupal too i just have a pair of weeks try in it, but seems a very good option for all this ways of customize it.
poker

Medical Job Australia wrote 2 years 19 weeks ago

Thanks for the tutorial link, I was having a similar problem and that site has very good drupal tuts.
thanks.
Medical Job Australia

TeseOpTinny wrote 2 years 17 weeks ago

You can't know it all. No matter how smart you are, no matter how comprehensive your education, no matter how wide ranging your experience, there is simply no way to acquire all the wisdom you need to make your business thrive.

Anonymous wrote 2 years 6 weeks ago

Thank you very much for the excellent and useful subject. Türkiyenin en iyi alışveriş sitesi. internette ucuz alışveriş yapabilme imkanı sağlar kadınlar için bayan giyim kategorisi altında yüzlerce ürün barındırır. Beyler için erkek giyim kategorisi içinde 100lerce giyim ürünü satılmaktadır. Ateşli geceler için fantazi giyim kategorisi altında cinsel hayatınızı daha sıcak ve daha sehvetli bir sekilde yasamaniz icin 100lerce ürün barındırmaktadır.! Evde beslemekte olduğumuz hayvalar için pet shop ürünlerini mağazamızdan temin edinebilirsiniz. Ucuz fiyatı ile cebinize dost outlet ürünlerimizle sizleri ucuz alışverişe davet ediyoruz. ha bide unutmadan iskenderun icinde lazim bogle bisi . en iyi haber sitesi budur. Otonuz için oto aksesuar burdan alınır.. Price of Raw Materials

Shurik wrote 1 year 48 weeks ago

Thanks a lot.

pharmacy viagra wrote 1 year 47 weeks ago

Hi! I read your post and found it really interesting.

Anonymous wrote 1 year 37 weeks ago

Hello, In number 7 you say: Create another display.So is the same view for all the tabs?. It should't be diferent views for every tab.Thank you.

joel box - Mondial-IT wrote 1 year 35 weeks ago

Hi great post, it helped me a lot. I have only one puzzle left.

How to use the same passed argument in all tabs?

My view displays information of a project. I want all tabs to only show information of that project. Normally it would be path/project/id and use an argument to select. In this case the tabs select the view and do not pass the (main) argument.

Any ideas ?

joel box - Mondial-IT wrote 1 year 35 weeks ago

Sorry, found the answer it's:

set the path to document/%/title, document/%/description etc. and the main menu path to document/% and add args. save and goto path /document/101 for example. et voila.

vix wrote 1 year 16 weeks ago

Thanks so much for this. It helped me do in 5 mins what otherwise would have taken hours to figure out.

Kamagra wrote 42 weeks 4 days ago

Thank you for sharing to us.Please one more post about that..This is really a fascinating blog, lots of stuff that I can get into. One thing I just want to say is that your Blog is so perfect!

jcmiller09 wrote 41 weeks 4 days ago

Just to Clarify how this works (thanks to the original author for posting a much-needed tutorial)

The first thing you create in the new view will be your default display (let's say a master list of all the fruit you are selling at your fruit stand) and it shows everything. You will make it a page view, and then set it's path.

The path will be a parent to all the other page views that you make, so the path will look like www.fruitstand.com/fruit.
Now you can set your options for the menu as described above, so you'd click the radio button for Default Menu Tab. In the title box, type what you want to appear in the actual display tab. Click "Update", and then the next dialog box appears. This gives you 3 radio button options, and you should click normal menu item. This brings up a set of fields to the right, and you have to enter a title, an optional description, and then you have to choose which menu this goes into. All the tutorials gloss over this bit, in that Views goes into Drupal's menu system and makes a new permanent entry into one of the existing menus when you enter a title. Unless you want a bunch of menu options that have nothing to do with your view (like your entire navigation menu!), you will want a fresh, blank menu, so go make it in the menu admin before you move on. Once you do that, you can select it under the title and description. Views then adds the menu option from the title you entered here. (go into the menu admin to see for yourself!) Click "Update" and that should be your default tab.

Next you want to make your other page views, of course with different filters or sorting. Set their paths to something like www.fruitstand.com/fruit/apples, so that it falls under the "parent" which is "/fruit." Go to the Page Settings: Menu, and select the radio button for Menu Tab. Enter the title you want to show up in the tab, and click "Update". This is all you need for each of the children, so make the rest of your alternate page views, and across the top will be your default view on the left end of the tabs, and the rest of them to its right.

This seems to be a clunky way to set it up, and there are more options in there that I don't even know what they do. Someone told me to check out quicktabs module, so I will do that and see if it's better than views' built in menu tabs.

Hope this clears the process up a little more regarding how it interacts with Drupals' menu system.

jcmiller09 wrote 41 weeks 4 days ago

Amendment to my comment: The default page view's path should actually not be set to the "parent." Using the case above, you'd want www.fruitstand.com/fruit/all. For some reason, when you actually go to the "parent" url, it does go to the default page view.

Dirty Water Pump wrote 35 weeks 2 days ago

I was very pleased to find this website. I wanted to thanks for your time for this wonderful read. I definitely enjoyed every little bit of it.

Anonymous wrote 26 weeks 19 hours ago

Talk dirty to me, water pump!

Phil wrote 22 weeks 1 day ago

I dunno why but when trying to create a new page with tabs using the following URL format, the tabs wouldn't show up:

/produce/fruit
/produce/fruit/apples

It wasn't until I set the /produce/fruit/apples to /produce/%/apples that the tabs started working...

Add your comment

The content of this field is kept private and will not be shown publicly.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Links

Recent comments