[Pmwiki-users] BreadCrumb Trails

Patrick R. Michaud pmichaud
Sat Feb 28 11:43:26 CST 2004


On Sat, Feb 28, 2004 at 05:16:18PM +0000, David Jackson wrote:
> I have had a go at implenmenting a breadcrumb trail & I am now at the 
> 'tearing out hair' stage ;-)
> 
> 'This should be easy to adapt', I stupidley thought, & came up with the 
> following:
> [...]
> But all I can see is 'Recently Viewed:' (At least I know it is being 
> included/called).
> Is this because the variables $HTMLTitle, $PageURL are not set before 
> this gets called?

Yup, that's why.  $PageUrl actually depends on the name of a page
when a link or other reference is being generated, which is not always
the url of the current page.  The way to get the url of the current
page is to use

    $path = FmtPageName('$PageUrl',$pagename);

Also, keep in mind that variables in PHP are local to functions
unless declared global, thus you'll need to include

    global $HTTP_COOKIE_VARS,$pagename;

in your function.

$HTMLTitle isn't the title of the page, it's the HTML that specifies
the <title>...</title> tag in the output.  If you want the page's title (name),
use

   $title = FmtPageName('$Title_',$pagename);   # never spaces WikiWord titles
or
   $title = FmtPageName('$Titlespaced',$pagename);  # always spaces title
or
   $title = FmtPageName('$Title',$pagename);	# spaces wikiwords if
                                                # SpaceWikiWords set


Finally, keep in mind that in XHTML all elements such as <div>, <b>, 
etc., have to be lowercase.  May not be important for your application
but others may want/need XHTML compatibility.

Pm



More information about the pmwiki-users mailing list