|
Cookbook /
PageListExtensionsSummary: Many Pagelist Enhancements
Version: 1.1
Prerequisites:
Status:
Maintainer: MartinFick
Categories: WikiTrails
Questions answered by this recipe
DescriptionPut pagelistextensions.phpΔ in your cookbook/directory. Add the following line to local/config.php @include_once("This recipe defines these new pagelist options: groupcount to specify how many groups to iterate through pergroupcount to specify how many pages per group to iterate through blank to specify a page to include if the pagelist is blank targets to specify a page to get targets from (similar to trail=) Note: the new {$$option} (see below) markup is available inside the blank page. This recipe also defines these new pagelist variables: {$PageTotal} the number of pages that would have been returned
without a count, groupcount, or pergroupcount
{$GroupTotal} the number of groups that would have been returned
without a count, groupcount, or pergroupcount
Finally, this recipe defines a special markup {$$option}. This new markup makes the (names and values of) options used in the pagelist directive available inside of pagelist templates. The special case {$$} returns the entire option string. Some examples: {$$count} displays the value of the count option
A custom option: (:pagelist lyric='Hello My Darling' ...:)
{$$lyric} displays Hello My Darling
NotesYou can see and edit a live example of this recipe here You can use the {$$trail} variable to get the trail index page if you want to create trail markup with a pagelist. Here are two trail pagelist templates to use with this recipe: fmt=#trail
[[#trail]]
(:if equal {=$FullName} {$FullName} :)\
<<[[{<$FullName}]] | [[{$$trail}]] | [[{>$FullName}]] >>\
(:if:)
[[#end]]
fmt=#trailtitled
[[#trailtitled]]
(:if equal {=$FullName} {$FullName} :)\
<<[[{<$FullName}|+]] | [[{$$trail}|+]] | [[{>$FullName}|+]] >>\
(:if:)
[[#end]]
You can follow the trail samples here Release NotesThis recipe was last tested with pmwiki v. 2.1.10. 2006-07-15 : PageListExtensions - version 1.1 - Martin Fick
2006-06-15 : PageListExtensions - version 1 - Martin FickCommentsThe beauty of this is that one can use this to make a pagelist which will then list ALL the trails that the current page is on (as distinct from DynamicWikiTrails which only lists the wiki-trail currently being traversed). First, one makes a pagelist format to reference (recursively) one of the above trail formats, and setting the above 'trail' variable to the currently matching page.
[[#trailtrail]]
(:pagelist trail={=$FullName} fmt={$$trailfmtpage}#{$$trailfmt}:)
[[#trailtrailend]]
When using the #trailtrail format, you give it the 'trailfmt' argument (which selects which 'trail' format to use). (If you don't then you end up with an endless recursion, so beware!) Then you make a pagelist which lists the pages which link to the current page. (:pagelist link={$FullName} trailfmt=trail fmt=#trailtrail:) You would add stuff to this pagelist definition to make sure that the list is limited to pages which are likely to have wikitrails on them, from what you know about the contents of your own wiki. For example, suppose you have three wikitrail pages you're interested in, GroupA/GroupA, GroupA/FooPage and GroupB/BarPage. You don't know if the current page is on any of them, but if it is you want the trail markup to be there. In that case, you would put (:pagelist group=GroupA,GroupB name=GroupA,FooPage,BarPage link={$FullName} trailfmt=trail fmt=#trailtrail:) (probably put it in the GroupHeader or GroupFooter to make it easier)
What comes out is all the trails which the current page is on, automatically, without having to add them by hand. Isn't that nifty? -- Kathryn Andersen July 28, 2006, at 06:12 PM
Er, what exactly does the 'targets' option do? Kathryn Andersen July 28, 2006, at 06:26 PM
Sounds great, but should this still work in 2.2.0-beta65? I don't want to spend hours trying to figure out where in config.php or farmconfig.php I should place it to make it work if it doesn't work at all... Anke January 10, 2008, at 02:16 AM See Also
Contributors |