TIP SectionListPlugin is not installed on Foswiki.org.

SectionListPlugin

Access the list of named sections in a topic

Description

This plugin lets you access the list of sections in a topic defined by VarSTARTSECTION and VarENDSECTION.

Syntax

%SECTIONLIST{"<topic>" ... <params>}%

returns a list of names of the sections

Parameter Description Default
"..." or topic="..." topic to list the sections of current topic
rev="..." revision of the topic latest revision
type="..." section type to extract, can be section, expandvariables, include, templateonly or all all
header="..." header string to prefix the result  
format="..." format for each list element $name
footer="..." footer string to appended to the result  
separator="..." string to separate list elements in the result ,
sort="on/off" boolean flag to enable sorting results by section name off
reverse="on/off" boolean flag to invert the order of the result off
include="..." regular expression to filter the result list  
exclude="..." regular expression to filter the result list  
limit="..." maximum number of sections to return all
skip="..." number of items in the list of sections to skip while rendering the outout 0

The format parameter can take the following variables:

  • $name the name of the current section
  • $type the type
  • $index index of the current item in the result list
  • $count list size of the result list
  • $total total number of sections in the topic
  • $web web name of the topic currently being processed
  • $topic topic name of the topic currently being processed
  • $rev revision of the current topic
  • standard format tokens such as $n and $percnt etc

Examples

a comma separated list of sections in the current topic:

You type:
%STARTSECTION{"example 1"}%
%SECTIONLIST%
%ENDSECTION{"example 1"}%

You get (if installed):

example 1, example 2

render an unordered list of links to view the named section

You type:
%STARTSECTION{"example 2"}%
%SECTIONLIST{
   format="   * <a href='%SCRIPTURLPATH{"view"}%/$web/$topic?skin=text&rev=%URLPARAM{"rev"}%&section=$name'>$name</a>"
   separator="$n"
}%
%ENDSECTION{"example 2"}%

You get (if installed):

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab -> "Install, Update or Remove extensions" Tab. Click the "Search for Extensions" button. Enter part of the extension name or description and press search. Select the desired extension(s) and click install. If an extension is already installed, it will not show up in the search results.

You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See https://foswiki.org/Support/ManuallyInstallingExtensions for more help.

Dependencies

None

Change History

26 Jan 2024 added $rev token
27 Mar 2018 initial version
I Attachment Action Size Date Who Comment
SectionListPlugin.md5md5 SectionListPlugin.md5 manage 174 bytes 26 Jan 2024 - 08:17 MichaelDaum  
SectionListPlugin.sha1sha1 SectionListPlugin.sha1 manage 198 bytes 26 Jan 2024 - 08:17 MichaelDaum  
SectionListPlugin.tgztgz SectionListPlugin.tgz manage 5 K 26 Jan 2024 - 08:17 MichaelDaum  
SectionListPlugin.zipzip SectionListPlugin.zip manage 8 K 26 Jan 2024 - 08:17 MichaelDaum  
SectionListPlugin_installerEXT SectionListPlugin_installer manage 4 K 26 Jan 2024 - 08:17 MichaelDaum  
Topic revision: r2 - 26 Jan 2024, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy