Author
|
Message
|
Lydie Soler
|
Friday 05 August 2005 2:36:34 am
Hi, I would like to know how I can get the parent of a node. Thanks for your help
|
Albert Hornos
|
Friday 05 August 2005 5:29:59 am
Lydie have you tried: {$node.parent}
Sometime easy things can work ;)
|
Lydie Soler
|
Friday 05 August 2005 5:51:09 am
I should have been more precise. I am using the treemenu and I wanted to know the parent of a node selected by this treemenu... But as far I as understood the documentation I don't think it can be done. Am I wrong?
|
Xavier Dutoit
|
Friday 05 August 2005 7:09:21 am
Slap the node until he cries and his parents are going to come. Then you can get them ;) (By night, that's likely you will only get the mother). I don't get the problem. Once you select a node (using the treemenu or otherwise), it's displayed in the full format. Then, with {$node.parent} on the full.tpl or the template overrided you display the parent. What am I missing ?
http://www.sydesy.com
|
David Eriksson
|
Friday 05 August 2005 7:20:20 am
The treemenu operator doesn't give you full nodes; see http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_operators/miscellaneous/treemenu Among the things it does give you, however, is the IDs. So you can always fetch() each and every node. Can be quite a nightmare performance-wise of course.
/David
|
Lydie Soler
|
Friday 05 August 2005 7:27:27 am
yes that's what I add noticed. But can I with this node-id get its parent-node? don't think so... you agree?
|
Xavier Dutoit
|
Friday 05 August 2005 7:59:32 am
Hi, assuming you're able to get the id of the node you want (from treemenu) into $currentnode
<ul>
{def $mainMenu=treemenu( $module_result.path, $module_result.node_id, array('folder','info_page'), 1, 6 )}
{foreach $mainMenu as $menu}
{let node=fetch( 'content', 'node', hash( 'node_id', $menu.id ) )}
{$node.parent|attribute(show,1)}
{/let}
{/foreach}
As David said, that's going to slow the pages quite a bit.
http://www.sydesy.com
|
Bertrand Dunogier
|
Friday 05 August 2005 12:20:01 pm
Yes, I had noticed the same thing with the tree operator. Anyway, as Xavier said, you can fetch in the usual way the node to get its ID. Regarding the performances issue, I suggest that you use cache blocks in a clever way, and it should work like a charm...
|
Philip K.
|
Monday 17 October 2005 1:36:07 am
You can get the ID of the parent by using {$node.parent.node_id} I had the same problem and it works :)
Linux is like a wigwam; no windows, now gates, and apache inside!
|