Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

DynamicTrails

Summary: Dynamic WikiTrails with pagelist
Version: 1
Prerequisites: pmwiki 2.1
Status: experimental
Maintainer:
Categories: Links, CMS, WikiTrails

Questions answered by this recipe

How can I create a trail through the pages of a group without having a trailpage?

This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.

Description

Add the following pagelist template formats to your Site.LocalTemplates and pagelist trail markup to the group's GroupHeader or GroupFooter page:

Dynamic trail of form prev.Name | Group | next.Name

[[#grouptrail]]
(:template each :)
(:if equal {*$FullName} {=$FullName}:)
%wikitrail%[[{<$FullName}|+]] | [[{*$Groupspaced}]] | [[{>$FullName}|+]]
(:ifend:)
[[#grouptrailend]]
(:pagelist group={*$Group} fmt=#grouptrail :)

Dynamic trail of form <<prev | Group | next>>

[[#grouptrail2]]
(:template each :)
(:if equal {*$FullName} {=$FullName}:)
%wikitrail%[[{<$FullName}| &laquo; prev ]] | [[{*$Groupspaced}]] | [[{>$FullName}| next &raquo; ]]
(:ifend:)
[[#grouptrail2end]]
(:pagelist group={*$Group} fmt=#grouptrail2 :)

The trail markup will link to previous and next pages in the group, and to the group's homepage. The group's homepage does not need to contain a list of pages, the pagelist markup is generating the trail links.

To make sure that RecentChanges and GroupFooter don't show up in the navigation when using the Dynamic Trails recipe use the list=normal option , eg

(:pagelist group={$Group} fmt=#grouptrail list=normal :)

To understand the use of the "*$" markup see page variable special references and pagelist template special references.

Variation: fmt=#nextontrail

Dynamic trail of form NextPageName link

[[#nextontrail]]
(:if equal {*$FullName} {=$FullName}:)
Next page: [[{>$FullName}|+]]
(:ifend:)
[[#nextontrailend]]
(:pagelist group={*$Group} fmt=#nextontrail list=normal:)

Notes

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

Note that this recipe may not work for you if (:pagelist:) is set to not return the current page in its results, I don't currently have a work around for this.

2008-10-05
I'm currently using this recipe on my site for Dynamic trail of form <<prev | Group | next>> but I made a small change to replace the "prev" and "next" with the page names of the prev and next pages. The change I made:

Replace this

%wikitrail%[[{<$FullName}| &laquo; prev ]] | [[{*$Groupspaced}]] | [[{>$FullName}| next &raquo; ]]

with this

%wikitrail%[[{<$FullName}| &laquo; {<$Namespaced} ]] | [[{*$Groupspaced}]] | [[{>$FullName}| {>$Namespaced} &raquo; ]]

The only problem I'm having with this recipe is that list=normal results in hiding the trail, even with the default template. The only workaround I can find is to use (:pagelist group={*$Group} name=-GroupHeader,-GroupFooter fmt=#grouptrail:) to remove certain pages from the pagelist. It works so it's not a big problem. Ian MacGregor

See Also

Contributors

Edit - History - Print - Recent Changes - Search
Page last modified on October 05, 2008, at 03:43 PM