Hello,
I need to know the parent ID’s of a page. Let’s say, i have a four level deep navigation and i like to know all it’s parents seen eg. from level 3.
I’m familiary with hasParent() and getParentID(), which gives me the parent one level up. And that’s the end of the road.
What i miss is somethng like getParentID()
The only way is see at the moment is to loop over the pageService to get the parents.
Ist this the right way?
Thanks
So you basically want to know the hierarchy?
Is that correct?
Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com
Social: twitter.com/lmajano facebook.com/lmajano
Yes, and the ID’s.
This is for the navigation. If a child is active, i also have to know it’s parents to apply the right CSS.
Here is a sample method for a visitor:
// visit
function visit(page,link){
var bc = “”;
if( arguments.page.hasParent() ){
bc &= visit( arguments.page.getParent(), arguments.link );
}
if( len( arguments.page.getTitle() ) ){
bc &= ’ #arguments.page.getTitle()# ';
}
return bc;
}
Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com
Social: twitter.com/lmajano facebook.com/lmajano
Hello Luis,
I will try this. page.getParent() and recursion is the key, great.