Displaying a page trail

View: New views
3 Messages — Rating Filter:   Alert me  

Parent Message unknown Displaying a page trail

by Dan Stanger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello All,
Many of the helma pages have a page trail for example:
helma.org > Home > docs > tools

Is there an example of how to create this in helma?
Thanks,
Dan Stanger
Eaton Vance Management
200 State Street
Boston, MA 02109
617 598 8261
_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user

Re: Displaying a page trail

by Joshua Paine :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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> > </span>
             + crumbs;
  }
  return crumbs;
}

--
Joshua Paine

_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user

Re: Displaying a page trail

by Chris Zumbrunn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Mar 24, 2008, at 21:17 , Dan Stanger wrote:
> Hello All,
> Many of the helma pages have a page trail for example:
> helma.org > Home > docs > tools
>
> Is there an example of how to create this in helma?

In addition to what Joshua said, the objects in the URI request path  
are accessible as array members of the global path object:

http://helma.zumbrunn.com/reference/global.html#path

Also, you should be able to access the immediate parent of a hopobject  
using its _parent property, like I'm doing here:

/**
* Provides an array of the path breadcrumbs from
* the this Mocha object up to the root object.
*/
Mocha.prototype.__defineGetter__('path',function() {
    var breadcrumbs = [];
    var obj = this;
    do {
        breadcrumbs.push(obj);
    }
    while (obj = obj._parent);

    return breadcrumbs;
});

http://code.google.com/p/e4xd/source/browse/trunk/objectengine/Mocha/lib.js

Cheers,
Chris


_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user
LightInTheBox - Buy quality products at wholesale price