[Helma-user] Displaying a page trail

Joshua Paine joshua at papercrown.org
Mon Mar 24 22:48:02 CET 2008


On Mon, 2008-03-24 at 16:17 -0400, Dan Stanger wrote:
> Many of the helma pages have a page trail for example:
> helma.org > Home > docs > tools

How to do this depends on your content structure. If your site is made
up of similar Page objects arranged in a hierarchy, and a page is
related to its parent through the pageParent property, a simple method
for retrieving a breadcrumb list might look like this:

function getBreadcrumbs() {
  var crumbs = <span>{this.title}</span>;
  var page = this;
  while(page = page.pageParent) {
    crumbs = <span><a href={page.href()}>page.title</a> &gt; </span> 
             + crumbs;
  }
  return crumbs;
}

-- 
Joshua Paine



More information about the Helma-user mailing list