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:
- Create a view.
- Name the path (url) to be what you want the default tab to be, for example, 'document/all'.
- Configure your view with sorting, filtering, etc.
- Choose 'Default menu tab' in Menu option and name it.
- Choose 'Normal menu item' to be the parent, since this tab is linked directly from a menu, i.e. 'document'
- Finish this first tab.
- Create another display.
- Name the path of this one as a tab option, like 'document/homework'.
- Configure it.
- Choose 'Menu tab' for this one.
- Finish this tab.
- Repeat (8) - (11) for more tabs.
That's it. Simple, huh? Please leave a comment if there's any mistake above.