Forums / General / Fetching nodes under a node's grandparent?
Jason Filby
Thursday 04 September 2003 1:01:54 pm
Hi, I need to get a fetch going that retrieves all nodes under the current node's grandparent. Written another way I need to get all node's at the level of the node's parent node.
I can't seem to get this working - any help is appreciated.
ThanksJason
Paul Forsyth
Thursday 04 September 2003 1:36:42 pm
Your current node has a link to its parent. Look at:
{$node|attribute(show)}
and you will see the syntax you need.
It is something like:
{let parent_node = fetch('content','node',hash(node_id,$node.parent_node_id)}
With this $parent_node you can some perform a standard fetch on its parent, like this:
{let nodes = fetch('content','list',hash(parent_node_id,$parent_node.node_id)}
which will grab all the nodes underneath the parent.
There may be a direct way to reach the id of the parents parent, look at the results of the attribute(show) call above. I can't experiment at the moment to confirm this.
Hope this helps
Paul