ez.no / ezpublish / documentation / incoming / how to find the parent and grandparent of an object
These documentation pages are no longer maintained. Please visit the new documentation site.
This example can be modified to be used in a number of templates, e.g. in the shopping basket (where I first made this). Some elements like the $current variable may be reduntdant (and can be replaced by simple $node) other places.
{let current=fetch('content','node',hash('node_id',$node.node_id))
parent=fetch('content','node',hash('node_id',$:current.object.main_parent_node_id))
grandparent=fetch('content','node',hash('node_id',$:parent.object.main_parent_node_id))}
Grandparent: {$:grandparent.name}
Parent: {$:parent.name}
Current: {$:current.name}
{/let}
Comments