Loading...
 
Skip to main content
Display a table of contents of pages in a structure

Plugin Table of Contents


Use this wiki plugin in a page belonging to a structure to 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

Display a table of contents of pages in a structure
Introduced in Tiki 3.
Go to the source code
Preferences required: wikiplugin_toc, feature_wiki_structure

Parameters Accepted Values Description Default Since
maxdepth digits Set the number of levels to display. 0 means only 1 level will be displayed and empty mean no limit (and is the default). 0 3.0
mindepth digits Set the level starting from which page names are displayed. 0 or empty (the default) means from level 1. Starting from 0 (and not 1). 0 15.3.
order (blank)
asc
desc
Order items in ascending or descending order (default is ascending). asc 3.0
pagename pagename By default, the table of contents for the current page will be displayed. Alternate page may be provided. 5.0
showdesc (blank)
1
0
Display the page description in front of the page name 0 3.0
shownum (blank)
1
0
Display the section numbers or not 0 3.0
sortalpha (blank)
struct
alpha
Order for the first Level of pages that will be displayed. Order by structure is the default. struct 15.3.
structId digits By default, structure for the current page will be displayed. Alternate structure may be provided. 3.0
type (blank)
plain
fancy
admin
Style to apply plain 3.0

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 parameter 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

Now PluginToc on the Examples page will show the three pages underneath it in the Full structure.

Using the pagename parameter

Passing the pagename is useful in (at least) two situations:

  1. When you want to have a master table of contents page of a structure as the last page in the structure.
  2. When you want to include a page (using PluginInclude) with PluginTOC used in another page.
    If you include the page with the TOC plugin without passing the name of the page to PluginTOC, the table of contents for the page where PluginTOC is included will be shown, instead of showing the TOC for the included page.
    This is useful for overview/portal pages.

Examples

All levels

This code:

Copy to clipboard
{toc structId="4020" shownum="1"}


Would produce on this site:

The page "Author Resources" used for the pagename parameter in the above example is the root page of a structure.

First level only with numerotation

This code:

Copy to clipboard
{toc structId="4020" sortalpha="alpha" mindepth="1"}


Would produce on this site:

From second level and sorted as in the structure

This code:

Copy to clipboard
{toc structId="4020" sortalpha="struct" mindepth="1"}


Would produce on this site:

Only second level and sorted from A to Z

This code:

Copy to clipboard
{toc pagename="Author Resources" sortalpha="alpha" mindepth="1" maxdepth="1"}


Would produce on this site:

Show description and no numbers

This code:

Copy to clipboard
{toc showdesc="1" pagename="Author Resources"}


Would produce on the main page of a structure (using the All the Documentation page in this example):


Note that in this example, the description is shown first and the title field shown second. If a page has no description field (like in many pages of the structure in this example), only this title will be shown.

Alias


Created by sylvie. Last Modification: Monday 15 November, 2021 22:37:23 GMT-0000 by drsassafras.

Tiki Newsletter

Delivered fresh to your email inbox!
Newsletter subscribe icon
Don't miss major announcements and other news!
Contribute to Tiki