Template:PageTabs

From Wikibooks, open books for an open world
Jump to: navigation, search
{{{1}}}  





 


The PageTabs Macro Itself   Documentation   Main Page  




 


Usage[edit]

Usage: 1 to 9 parameters for each tab to put on the page. Whichever parameter is the current page is indicated by This= and the tab number to mark as the current tab, from 1 to 9. The 'This=' parameter allows the tab for the current page that the user is looking at to be white instead of blue. Note that in the example above (and below) the item 'main page' refers to the main page of Wikipedia; if you click on it, you will go there. This is to show that you can put links to pages that do not have tabs on them.

Generally, you'd use this macro where you had several pages and wanted them all to link to each other in the same way, and if you added new pages, they would consistently appear in the same place. Like your user page and comments on it.

Note that in the examples below, you would change "User_Example" to whatever user name it actually was, and "First Page", etc., to the page names you are going to use.

One way to do this is to create a tabs page, which would consist of the following:

{{PageTabs
|NOTOC = true
|[[User_Example:First Page]]  
|[[User_Example:Second Page]]
|[[User_Example:Third Page|Alternate Name for third page]]
|[[User_Example:Fourth Page]]
|This={{{This|1}}}
}}

In the above example, the last item makes the default white tab page the first example if you don't change it. So if you don't put 'This=' on the page, the first tab would be white regardless of which page they were looking at. The first item suppresses the table of content.

Now, you'd save that page, lets say it was called [[User_Example:Tabs]] and then, go to each page, starting with [[User_Example:First Page]] and put a macro call at the top of that page, in the form {{User_Example:tabs|This=1}} on that page, and use the same thing but use This=2 instead of This=1 on "Second Page", and so on for This=3, etc. You can have up to 9 pages using this macro.

An example has been done for this page at Template:PageTabs/tabs. Do not use this directly in your own set up, it is strictly for demonstrating how this works and documenting its use. Examine the page and the source to understand how to use this functionality. I think it is both fun to use and very useful in putting a condensed amount of information (such as cross-page links) in a very small space.

Here's how it looks if you put it on the bottom of the page, which is why you generally put it at the top:


The PageTabs Macro Itself   Documentation   Main Page