Retrieving parent when creating a new object

Author Message

Thomas Nunninger

Tuesday 17 January 2006 7:58:17 am

Depending on the parent where a new object is created I want to prefill an (object relation) attribute. But in the templates/content/datatype/edit/ezobjectrelation.tpl I do not have access to the parent because the object doesn't contain this data (yet). When editing an earlier created object that information is given.

Is there any possibility to retrieve the parent object/node? Where is the parent node/object saved while creating a new object? Or do you have any other ideas?

Thank you

Thomas

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

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

eZ debug

Timing: Jan 18 2025 16:00:42
Script start
Timing: Jan 18 2025 16:00:42
Module start 'layout'
Timing: Jan 18 2025 16:00:42
Module start 'content'
Timing: Jan 18 2025 16:00:42
Module end 'content'
Timing: Jan 18 2025 16:00:42
Script end

Main resources:

Total runtime0.8835 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 588.0469152.6406
Module start 'layout' 0.00650.0026 740.687539.4766
Module start 'content' 0.00910.8728 780.1641541.6250
Module end 'content' 0.88190.0015 1,321.789112.1250
Script end 0.8834  1,333.9141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.4343160.0002
Check MTime0.00130.1492160.0001
Mysql Total
Database connection0.00090.106110.0009
Mysqli_queries0.806291.2542570.0141
Looping result0.00060.0624550.0000
Template Total0.850696.320.4253
Template load0.00210.242720.0011
Template processing0.848496.035820.4242
Template load and register function0.00020.024610.0002
states
state_id_array0.00140.162710.0014
state_identifier_array0.00100.109920.0005
Override
Cache load0.00180.2030230.0001
Sytem overhead
Fetch class attribute can translate value0.00090.101720.0004
Fetch class attribute name0.00310.356450.0006
XML
Image XML parsing0.01261.426820.0063
class_abstraction
Instantiating content class attribute0.00000.001460.0000
General
dbfile0.01191.3488220.0005
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs