PageListExtensions

Summary: Many Pagelist Enhancements
Version: 1.1
Prerequisites:
Status:
Maintainer: MartinFick
Categories: WikiTrails PageList

Questions answered by this recipe

  • How can I alter values other than the values of the pages being iterated over in a pagelist template?
  • How can I specify a warning message when a pagelist directive does not return any pages?
  • How can I accurately limit the # of pages returned with the fmt=group option?
  • How can I, as an author, alter trail markups, can they use titles?
  • How can I get a pagelist of targets from a page?

Description

Put pagelistextensions.phpΔ in your cookbook/directory.

Add the following line to local/config.php

    @include_once("$FarmD/cookbook/pagelistextensions.php");

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

Notes

You 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 Notes

This recipe was last tested with pmwiki v. 2.1.10.

2006-07-15 : PageListExtensions - version 1.1 - Martin Fick

  • Added targets= option

2006-06-15 : PageListExtensions - version 1 - Martin Fick

See Also

Contributors

Comments

See discussion at PageListExtensions-Talk

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.