Questions answered by this recipe
How can I get page listings in a "dictionary index" format, i.e., segregated by initial letter of the page name?
(:pagelist group=Cookbook fmt=dictindex:) (:searchresults group=Cookbook text=index fmt=dictindex:)
For example: the wiki page
[[Category.GroupFooter]] can be edited via the wiki and changed so that 'list=normal' can be changed to 'fmt=dictindex' this way every category page will have a dictindex.
Add this line:
to your local/config.php file
To prevent the index links (letters at the top — A, B, C, etc.) from being displayed, set the following in
$DictIndexShowLetterLinksByDefault = false;
letterlinks parameter (may be
$DictIndexShowLetterLinksByDefault, allowing you to control whether the index links are shown or not, for each individual pagelist, like so:
(:pagelist group=PmWiki list=normal fmt=dictindex letterlinks=0 :)
(:pagelist group=Site list=all fmt=dictindex letterlinks=1 :)
Enable page listings using a "dictionary index" format via fmt=dictindex
- The output can be customized by various $FPLDictIndex...Fmt variables -- see the documentation in the script for details.
- extdictindex.phpΔ is a modified version of this script so that every index letter has an anchor
<a name='$IndexLetter'></a>and that
$FPLDictIndexStartFmtcontains an index
A - B - C - ...where every letter links to the appropriate anchor in the index. Should be useful for a large numer of search results... Nils Knappmeier
- Just modified it to work also with PmWiki 2.0beta39 Klonk
- titledictindex.phpΔ is a modified version of this script. It contains the additions made in
extdictindex.phpbut lists not the pagenames, but the pagetitles defined in the separate files. If no pagetitle is defined the pagename will be displayed. I personally think this is the most universal variant. Klonk
- Modified it to deal better with lowercase titles (also fixed up the whitespaces) Norman Rasmussen
- Modified with some optimizations as suggested by Pm - Klonk
- Unfortunately it is not Valid XHTML 1.0 Transitional (W3C Markup Validation Service: http://validator.w3.org/). Seven errors occured.
- you can change to this
SDV($FPLDictIndexStartFmt,"<p id='dictindexheader'>\$IndexLinks</p>\n<dl class='fpldictindex'>\n"); SDV($FPLDictIndexEndFmt,'</dl>'); SDV($FPLDictIndexLFmt,"<dt><a href='#dictindexheader' id='\$IndexLetterID'>▲</a> \$IndexLetter</dt>\n"); SDV($FPLDictIndexIFmt,"<dd><a href='\$PageUrl' title='\$Group : \$Title'>\$Title</a></dd>\n"); SDV($FPLDictIndexHeaderLink,"\n".'<a href="#$IndexLetterID">$IndexLetter</a>');- She
- you can change to this
- If you have problems with the above version of titledictindex.phpΔ not displaying the index letters in version 2.2.0-beta44 of the wiki (sorry, not verified for other versions) try replacing line 40 with "$pletter = substr($item['=title'],0,1);" (without the quotes). Daniel Rosendorf - Thanks, included this change - Klonk
- Incorporated changes provided by She (with a correction for s/$IndexLetterID/IndexLetter/ ). This now validates properly. Said Achmiz August 15, 2017, at 2:14 PM
- Modified titledictindex.php to allow a string to be inserts at the end of each letter block (in case, e.g., you want to enclose each letter section in a div, etc.). Said Achmiz August 15, 2017, at 4:33 PM
- Modified titledictindex.php to optionally show, or not show, the list of index links (the letters A, B, C, at the top). Said Achmiz August 21, 2017, at 12:15 AM
- toggledictindex.phpΔ is modified from titledictindex.php and displays the list by pagetitles but initially hidden, and each section gets toggled in and out of view by clicking on the letter in the list's header. This script uses elements from togglelink.php, but does not need it to run. ~HansB August 01, 2006, at 10:31 AM
- 20210426 - update for UTF-8, hide warnings for PHP8. (Petko)
- FplByDays -- fmt=bydays for pagelists; A custom format for YYYYMMDDHHMM format page names.
- Original author: Pm, 19-Oct-2004
- Nils Knappmeier
- Klonk, PmWiki 2.0beta39 era
- HansB,August 01, 2006, at 10:31 AM
- Said Achmiz
See discussion at DictIndex-Talk