FauxTrail
Questions answered by this recipe
How can I get page listings to behave like a trail?
Description
Enable page listings to have a "trail-like" format via fmt=fauxtrail
This recipe creates a few different trail-like pagelist formats.
They all basically look like this:
<< [[PrevPage|{PrevPage$Title}]] | [[Index Page]] | [[NextPage|{NextPage$Title}]] >>
The main difference in the different formats is what page is used as the "index" page of the faux-trail.
Because these are PHP-function formats rather than pagelist templates means that they are more efficient, and thus faster.
Activation
To activate this recipe, download fauxtrail.phpΔ and put it into your cookbook directory. Add the following line to your local/config.php:
include_once("$FarmD/cookbook/fauxtrail.php");
fmt=grouptrail
The grouptrail format makes a "trail" of pages in a group. The "index" page for this faux-trail is the home-page of the current group. This uses the special search-pattern "content" because the "normal" search-pattern excludes the current page, and these trail formats won't work if the current page is excluded.
(:pagelist group={$Group} name=-{$Group} list=content order=name fmt=grouptrail:) |
fmt=fauxtrail
The fauxtrail format is the general form of the format. This takes extra options, so that you can customize it to your preference.
- trailpage
- the page to use as the "index" page for the faux-trail
- label
- the label to give the "index" page
The following gives the same results as grouptrail:
(:pagelist group={$Group} name=-{$Group} list=content order=name fmt=fauxtrail trailpage={$Group} label={$Group}:) |
Note that if the current page isn't part of the faux-trail, then the pagelist will give no results. (This is a feature, not a bug).
(:pagelist group=Main list=content order=name fmt=fauxtrail trailpage=Main label=Home:) |
The fauxtrail markup is useful for more specialized trails; for example, a trail of everything in the same category.
(:pagelist group={$Group} link=Category.FPL list=content order=name fmt=fauxtrail trailpage=Category.FPL label="Pagelist Formats":) |
fmt=trailtrail
The trailtrail format is slightly different. This looks for all the normal trails that the current page is part of, and displays the trails (as fauxtrail markup). If the current page isn't part of any trail, then nothing will be displayed.
(:pagelist list=content fmt=trailtrail:) |
Notes
Release Notes
- 0.01 (2007-06-17) Initial release.
See Also
Contributors
Comments
See discussion at FauxTrail-Talk
User notes +1: 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.