[pmwiki-devel] Patch: Improvement to Trails

Ed W lists at wildgooses.com
Thu Apr 2 12:52:40 CDT 2009


I wanted more flexibility in the page trails feature and right now the 
implementation is tightly coupled with the ouput.  I modified the 
existing functions and broke them out into one function to generate the 
data and another to format it.  Not shown here, but this makes it very 
simple to override just the output to format things differently

Grateful if it could be accepted into core for a future release.  Note, 
I pasted the whole file for easy viewing - the changes only occur after 
the ReadTrail function.

There are a couple of other changes I didn't make, but I would recommend:

Change the default trail separator to something more standard, eg "»" 
(it looks like >> for those viewing in plain text):
    SDV($TrailPathSep, ' » ');

Also at the end of the MakeTrailPath I would recommend that the trail is 
always wrapped in a span, regardless of whether there is a trail or 
not.  Otherwise if the site owner has styled the trail then it will 
suddenly jump to become an unstyled plain word when the trail is empty 
(use another style even - that way it can be easily removed when the 
trail is empty..)

    return "<span class='wikitrail'>$trailname</span>";

After these changes it's easier to quickly override the formatting for 
any of the wiki trails.  Also there is now a prev and next link which 
points only to items within the same level of the wiki trail (default 
remains as before which is simply to jump to literally the next bullet 
item, regardless of relative level

Ed W

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20090402/8bf99435/attachment.html 

More information about the pmwiki-devel mailing list