Summary: Enable page listings using a "dictionary index" format via fmt=dictindex
Version:
Prerequisites:
Status: Working
Maintainer:
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?
Answer
The dictindex.phpΔ script will enable page listings using a "dictionary index" format. This format can be used by anything that produces a page listing; i.e., one can do things like:
(:pagelist group=Cookbook fmt=dictindex:)
(:searchresults group=Cookbook text=index fmt=dictindex:)
Description
Enable page listings using a "dictionary index" format via fmt=dictindex
Notes
- 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 $FPLDictIndexStartFmt contains 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.php but 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.
- 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
- 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
Release Notes
If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".
Comments
See Also
Contributors
Examples/Sandbox
List of all pages in Cookbook containing the word "google":
(:searchresults group=Cookbook fmt=dictindex google:)
|
|
|
Questions
Q) Is it possible to alphabetize to a foreign alphabet (I need cyrillic). Thanks. LFS
A) 23 Jan 2008: I replaced line in cookbook:
$pletter = substr($item['name'],0,1); with
$pletter = preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,0}'.
'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,1}).*#s',
'$1',$item['name']);
Q) It could be possible that the dictindex show pages with spaces. For example for this page: "PageForExample", it should show "Page For Example", Thanks.
A) This question has already been asked and answered on this page. Read below for solution, third block from the bottom of the list.
Q) Where do the $FPLDictIndex...Fmt variables go?
Q) Is it possible to display $Title and $CurrentTime (the editing date) in the list result?
Han, 12 februari 2005 at 16.31 CET
Noted this option ceased to return any values after upgrading to beta 34
Des, 23 April 2005 at 23:55
Now fixed for beta33 and later. --Pm
Apologies: I failed to mention I had installed extdictindex.php. dictindex.php is working fine in beta35.
Des, 25 April 2005 at 19:55
I'll see if I can combine the two. --Pm
I replaced $Name by $Titlespaced in the dictindex.php to get nice and easy to read page titles - "My Way To Happiness" just looks better than "MyWayToHappiness" to humans ;-) How about adding an option to let the admin choose the type of display?
DoubleSteve June 13, 2005, at 05:45 PM
- Just add the following before the include_once entry for dictindex in config.php to over-ride the default setting
$FPLDictIndexIFmt="<dd><a href='\$PageUrl'>\$Titlespaced</a></dd>";
(Des Jan 25, 2006)
Is there a way to get the title displayed (and sorted after), that is set within the files?
Klonk July 7, 2005 ... found it myself, see above.
With dictIndex (:publish:) doesn't work
titledictindex.php was working correctly with pmwiki version 2.1.27 but not anymore with beta 2.20.57 - suddenly entries with for instance a p are within m indexed.