Forums / Setup & design / Retrieving parent when creating a new object

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

eZ debug

Timing: Jan 18 2025 14:55:17
Script start
Timing: Jan 18 2025 14:55:17
Module start 'content'
Timing: Jan 18 2025 14:55:17
Module end 'content'
Timing: Jan 18 2025 14:55:17
Script end

Main resources:

Total runtime0.7872 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 587.8438180.8125
Module start 'content' 0.00640.6268 768.6563546.7188
Module end 'content' 0.63320.1539 1,315.3750332.7422
Script end 0.7871  1,648.1172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.5076210.0002
Check MTime0.00150.1933210.0001
Mysql Total
Database connection0.00090.110410.0009
Mysqli_queries0.710990.30941940.0037
Looping result0.00210.26161920.0000
Template Total0.759596.520.3797
Template load0.00180.230620.0009
Template processing0.757796.248720.3788
Template load and register function0.00020.029310.0002
states
state_id_array0.00090.111510.0009
state_identifier_array0.00070.085120.0003
Override
Cache load0.00150.1910230.0001
Sytem overhead
Fetch class attribute can translate value0.00150.196130.0005
Fetch class attribute name0.00100.121550.0002
XML
Image XML parsing0.00520.656030.0017
class_abstraction
Instantiating content class attribute0.00000.001460.0000
General
dbfile0.00901.1371330.0003
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs