Retrieving parent when creating a new object

Retrieving parent when creating a new object

Tuesday 17 January 2006 7:58:17 am - 2 replies

Author Message

Esteban Rodriguez

Tuesday 17 January 2006 10:39:28 am

Hi Thomas,

Let me see if I got you right.
I sometimes use the parent object when creating a new object to get some attribute or other. Say you have a folder in which you have the users post images, something like a guest book.
I generally use the description of the parent folder for the posting instructions in this guestbook affair, this description is brought by the edit template.

{let Parent=fetch( 'content', 'node', hash( 'node_id', $object.current.main_parent_node_id ) )}
    {$Parent.object.data_map._NEEDED_ATTRIBUTE_}
{/let}

I guess you could use that to fetch whatever attribute you need from the parent for your object relation.

Hope it helps

I have great faith in fools; self-confidence my friends call it.

http://presencia.net

Thomas Nunninger

Tuesday 17 January 2006 1:30:07 pm

Hi Esteban,

thank you for your reply. My problem was a little bit different (but just a little bit :-) I needed the parent object in an attribute_edit_gui template. I didn't find a way to access the parent directly from this template. So I originally tried to pass the variables in edit_attributes.tpl - but I had a typo :( Now it works.

Thank you

Thomas

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.