Plugin Toc
TOC is short for "table of contents." Using a {toc} tag in a page belonging to a structure will display a table of contents listing that page's sub-pages (see also Structures). Nothing will be displayed if the page doesn't have sub-pages.- Used in the structure's 'root' page, a full table of contents for the entire structure will be created.
- Used in a sub-page, a chapter table of contents will be created (showing only the sub-pages to that page).
Parameters
Default options for the possible parameters are shown below in bold.Parameter |
Value |
Description |
|---|---|---|
| order | asc or desc | order |
| showdesc | 0 or 1 | show the description of the page |
| shownum | 0 or 1 | show the numbering |
| type | plain or fancy | if fancy, show automatically the description of the page and use the fancytoclevel class for each line instead of toclevel class |
| structId | number (default: structure ID that the page belongs to) | the id of the structure, or the name of the structure (tw >2), or the page_ref_id of a page within a structure (see below for more information) |
| maxdepth | number (default: 0) | maximum depth of tree to be created, any number starting from 0, which means no limit |
| pagename | string (default: current page name) | the name of the page to create a toc for |
Same Page in Multiple Structures
Navigating to a page that is included in multiple structures can cause a PluginToc used on that page to behave unexpectedly. In these cases the structId parameter should be used to set behavior.For example, assume we have one structure called "Full" and one called "Shell" and we have a page called "Examples" that is included in both. In the Full structure, the Examples page has three pages under it called "Example 1", "Example 2" and "Example 3", whereas in the Shell structure there are no pages under the Examples page.
If you want the three example pages to show in PluginToc every time the Examples page is brought up, then the structId parmeter should be set to be the page_ref_id of the Examples page in the Full structure. To determine what this page_ref_id is, do the following:
- Go to tiki-admin_structures.php
- Click on the name of the structure ("Full" in this example)
- On the page that comes up, mouse over the page name where PluginToc is being used ("Examples" in this example)
- Note the page_ref_id that is part of the URL when you mouse over the page name
- Set the structId parameter in PluginToc to equal the page_ref_id noted
Example 1: type plain
This code:{toc order=asc shownum=1 type=plain }Would produce on the main page of a structure (using the Documentation TOC page in this example):
Example 2: type fancy
This code:{toc order=asc shownum=1 type=fancy }Would produce on the main page of a structure (using the Documentation TOC page in this example):
Example 3: type fancy, showdesc
This code:{toc order=asc shownum=1 type=fancy showdesc=1 }Would produce on the main page of a structure (using the Documentation TOC page in this example):
Note that in this example, the description is shown first and is the hyperlink, and the title field shown second. If a page has no description field (like in many pages of the structure in this example), no description, link or title will be shown. So only use this option if ALL the pages in the table of contents have the description field set.
Example 4: pagename
This code:{toc pagename="Documentation"}Would produce a table of contents for the Documentation TOC page.
Passing the pagename is useful in (at least) two situations:
- When you want to have a master table of contents page of a structure as the last page in the structure.
- When you want to include a page (using PluginInclude) with a toc tag in another page.
If you include the page with the toc tag without passing the name of the page to the toc tag, the toc will show the table of contents for the page where it is included, instead of showing the toc for the included page.
This is useful for overview/portal pages.
Note: If you need to include a page with a toc from a different struture, you might need to pass the structure ID as well.
