BreadCrumbTrail

<< | Cookbook-V1 | >>

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


I moved the previous contents of this page (keeping track of the most recently visited pages) to VisitedPageTrail, to make room for a "bread crumb" trail following the common web usage. --Pm

Question

How can I add a "bread crumb trail" to my pages?

Answer

First, define a variable called $BreadCrumbFmt that contains what you want output for the trail:

    
    $BreadCrumbFmt = "<span class='breadcrumb'>
      <a href='\$ScriptUrl'>Home</a> :
      <a href='\$ScriptUrl/\$Group'>\$Groupspaced</a> :
      \$Titlespaced </span>";
    

Then, simply add the variable $BreadCrumbFmt into your layout template file at the point where you want the trail to be displayed. The above example would display as

Note that in this approach it's possible to have specialized per-group or per-page bread crumb trails by setting different values for $BreadCrumbFmt in PerGroupCustomizations.

If you want to provide a bread crumb markup that authors can place into a wiki page to display a bread crumb trail, you can also add something similar to the following:

    
    $DoubleBrackets['[[$Breadcrumb]]'] = 
      Keep(FmtPageName($BreadCrumbFmt,$pagename));
    

Notes

Comments

  • Is there any way using this method to have a greater number of structure levels than permitted by group/page? Am I right in thinking that PmWiki does not allow for subgroups? Do I need to use Trail2Menu?
    • Ok, I think I have (partly) answered my own questions: Trail2Menu will do what I need. Only problem is I am using version 2.08, and I don't think Trail2Menu has been updated yet...
      Francis April 07, 2005, at 05:27 AM

Contributors

  • Pm, 18-Mar-2004

pmwiki-2.3.38 -- Last modified by {{Francis}}

from IP: 85.171.160.186 ip should be disabled by default for security reasons