[pmwiki-users] Re: Dynamic wiki trails - passing along the name of the trail page
Patrick R. Michaud
pmichaud at pobox.com
Mon Mar 14 09:18:09 CST 2005
On Mon, Mar 14, 2005 at 09:37:34AM +0100, chr at home.se wrote:
> On 14 Mar 2005, John Rankin wrote:
> > Or, pmwiki contains SDV($TrailPage,TrailPage); and an
> > if (PageExists(FmtPageName("\$Group.$TrailPage",$pagename)))
> > add ?trail=Group.TrailPage to all urls. An administrator can
> > override the default $TrailPage at the group, wiki or farm level.
> >
> > Er, but what happens if a page is on more than one trail??
>
> Quite... which is why something is needed to indicate which trail the user
> is currently traversing.
> [...]
No, I think there are other much cleaner ways to do this. First, we can
generalize the $TrailPage variable to be an array. But since we're
talking about automatically finding and placing pages on trails, let's
call it $AutoTrailsFmt:
$AutoTrailsFmt = array('$Group.TrailPage', 'Main.TrailPage',
'PmWiki.DocumentationIndex');
This says that we want to automatically check to see if the current page
is on any of the listed trails. Then, instead of trying to fix <<||>>
and friends, or introduce a (:trailpage:) markup that has to be placed
on trail pages, just define a (:trails:) markup that checks the pages
given by $AutoTrailsFmt and generates the appropriate <<||>> entries
for each trail that matches. If none of the AutoTrails match, nothing
is generated.
(:trails:) can then be placed in a GroupHeader, GroupFooter, on
individual pages, or in the skin template as appropriate.
We could possibly generalize this a bit further, by allowing the
list of pages in $AutoTrailsFmt to be read from a trail, but I'm not
sure how to do per-group trails in this case.
Or, if we now slap our hands to our collective foreheads, we find
that we can eliminate $AutoTrailsFmt entirely by defining the markup as
(:trails {$Group}.TrailPage Main.TrailPage PmWiki.DocumentationIndex:)
which says to generate <<|trail|>> links for any of the listed trails
that the current page happens to be a member of. Now we've eliminated
?trail= from uris entirely, and made it fairly easy to do large-scale trail
manipulations at page, group, site, and skin levels.
A site-wide trail list could be maintained by the administrator and
specified with something like
(:trails {$SiteTrails}:)
and someday in the future we might envision things like
(:trails category=TrailPages:)
(:trails trail=Main.MasterTrailList:)
Pm
More information about the pmwiki-users
mailing list