Re: Displaying a page trail

Joshua Paine <[email protected]> Mon, 24 Mar 2008 17:48:02 -0400
Newsgroups gmane.comp.java.helma.general
Message-ID <1206395282.30768.38.camel@Lenny>
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