Share » Forums » Developer » Get name of Parent Node

Get name of Parent Node

Get name of Parent Node

Thursday 10 July 2003 2:02:12 pm - 5 replies

Author Message

Karsten Jennissen

Friday 11 July 2003 12:03:04 am

Hi Alex,

you can dig in the demo examples. That's the best way to learn the template language. Browse through the demo site, identify a view that you want to learn about, turn on template debug to see which templates are being used. You can just copy the examples used there.

hth
Karsten

Paul Forsyth

Friday 11 July 2003 1:48:42 am

I find that i often need to use a fetch operator to retreive the node based on the parent id.

Remember to also use the show command to find out what attributers an object has. eg

{$node|attribute(show)}

paul

Alex Jones

Friday 11 July 2003 6:57:25 am

Hrrrm, this seems a bit odd that we can easily generate the parent node id, though not the parent node name... I will use a fetch to grab the info, but it seems to me this should be as easy to retrieve as the node id.

Any reason why my belief doesn't make sense?

As always, I appreciate the prompt reply Paul and Karsten!

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Sergiy Pushchin

Friday 11 July 2003 8:00:46 am

The thing is that parent_node_id is direct attribute for node, i mean it is stored in the same database row, if you want to know the name of parent node you need to fetch it. And there is attribute (so called functional attribute) for node called "parent". So to do what you want, you need to write $node.parent.name.

Alex Jones

Friday 11 July 2003 8:23:00 am

Thanks Sergiy! Knowing about .parent.name helped me figure out what I was doing wrong!

FYI Karsten, I was actually adapting the "Creating Tree Menus" example (http://www.ez.no/developer/ez_publish_3/documentation/customization/tips_tricks/creating_tree_menus) for my code which is how I came up with the question. I'm trying to ramp up my examining code in general, reading the docs and asking lots of questions (as Paul can attest to).

I'm learning as quickly as possible. :)

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu