Forums / Setup & design / how can i pass parameters from one of my templates to another (using attribute_view_gui)

how can i pass parameters from one of my templates to another (using attribute_view_gui)

Author Message

Bjørn Torkel Dahl

Thursday 03 March 2005 9:21:29 am

I include an embedded view in on of my templates using attribute_view_gui, but I include the same class object several places in the same teplate, and would like for it to behave diffrently from place to place.

i.e:

{attribute_view_gui attribute=$node.object.data_map.relaterteartikler}
{attribute_view_gui attribute=$node.object.data_map.eksternepekere}

is object relation lists with the same class, template looking like this:

--
{section show=$object.data_map.location.has_content}
<a href={$object.data_map.location.content|ezurl}>{$object.data_map.name.content}</a><br />
{/section}
--

but I'd like for one of them to behave a lil diffrently than the other, i'e by sending some parameter i could check for in the template.

Anyone knows how to do this?

--
btd

Paul Forsyth

Thursday 03 March 2005 9:57:50 am

Yip, just add parameters to the attribute_view_call. Read this doc:

http://ez.no/ez_publish/documentation/reference/template_functions/gui/attribute_view_gui

paul

Bjørn Torkel Dahl

Thursday 03 March 2005 10:10:39 am

yeah, but where do I recall the parameter?

--
btd

Paul Forsyth

Thursday 03 March 2005 10:56:30 am

If you try:

{attribute_view_gui attribute=$attribute my_new_parameter=1}

in your template use:

{$my_new_parameter}

paul

Bjørn Torkel Dahl

Thursday 03 March 2005 11:03:34 am

That was what struck me as logical as well, but I cant seem to make it work. This is the code as of now:

in template 1:
{attribute_view_gui attribute=$node.object.data_map.eksternepekere btdfoo=bar}

template 2:
--
<h1>{$btdfoo}</h1>
{section show=$object.data_map.location.has_content}
<a href={$object.data_map.location.content|ezurl}>{$object.data_map.name.content}</a><br />
{/section}
--

but no output from {$btdfoo} is produced. the <h1></h1> is displayed though..

--
btd

Bjørn Torkel Dahl

Thursday 03 March 2005 11:14:21 am

not sure what happened there, but my post was lost.. did you moderate me, Paul? :)

Anyhow... It doesnt produce anything in the template output. Here is the current code:

In template 1:
--
{attribute_view_gui attribute=$node.object.data_map.eksternepekere my_new_parameter=1}
--

Template 2:
--
<h1>{$my_new_parameter}</h1>
{section show=$object.data_map.location.has_content}
<a href={$object.data_map.location.content|ezurl}>{$object.data_map.name.content}</a><br />
{/section}
--

$my_new_parameter does not display anything. the <h1> tags are displayed, so I'm sure its not a cache issue.

--
btd

Paul Forsyth

Thursday 03 March 2005 12:47:29 pm

Which template are you trying to view the parameter with?

The attribute_view_gui call will fetch your attributes template ie:

design/standard/templates/content/datatype/view/ezobjectrelationlist.tpl

This, or its override, is where your new parameter is valid.

paul

Bjørn Torkel Dahl

Thursday 03 March 2005 12:55:29 pm

I've created an override template for embedded links (links that is listed as object relations).

I know it uses the correct override, cause the template is parsed as it should be. (all other output is correct).

Is there a setting that disables the possibility to send parameters between templates? This is a vanilla 3.5 installation.

--
btd

Paul Forsyth

Thursday 03 March 2005 1:02:10 pm

No, it should work by default.

Can you list the file paths of the templates involved? Maybe that will help to show the connection between them.

paul

Bjørn Torkel Dahl

Thursday 03 March 2005 1:24:36 pm

/node/view/full.tpl overridden by
design/nteu/override/templates/node_view_full_articlewithobjects.tpl
for class articlemedobjekter

design/nteu/override/templates/node_view_full_articlewithobjects.tpl
contains
--
{section show=$node.object.data_map.eksternepekere.has_content}
<div class="hoyreboksmainboks">
<span class="bold">Eksterne pekere:</span><br />
{attribute_view_gui attribute=$node.object.data_map.eksternepekere my_new_parameter=1}
</div>
{/section}
--
eksternepekere is a object relation list consisting of only "link" class objects

/content/view/embed.tpl overridden by
design/nteu/override/templates/node_view_embed_link.tpl
for class "link"

design/nteu/override/templates/node_view_embed_link.tpl
contains
--
<h1>{$my_new_parameter}</h1>
{section show=$object.data_map.location.has_content}
<a href={$object.data_map.location.content|ezurl}>{$object.data_map.name.content}</a><br />
{/section}
--

--
btd

Paul Forsyth

Thursday 03 March 2005 1:39:39 pm

Ok, it looks like you are not override the object relation list, eksternepekere, template itself. Try overriding this template:

design/standard/templates/content/datatype/view/ezobjectrelationlist.tpl

and try your passed in parameter. This is the only place your parameter will be exist.

inside the datatype template you may need to pass your parameter on for it to reach your link override.... ;)

btw, you can use parameters in other places too, {include ...}, {content_view_gui ...} etc.

Bjørn Torkel Dahl

Friday 04 March 2005 9:27:31 am

Ohh. yess..

tnx a lot

--
btd

eZ debug

Timing: Jan 18 2025 19:06:32
Script start
Timing: Jan 18 2025 19:06:32
Module start 'content'
Timing: Jan 18 2025 19:06:32
Module end 'content'
Timing: Jan 18 2025 19:06:33
Script end

Main resources:

Total runtime0.1946 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 589.7422180.7813
Module start 'content' 0.00590.0083 770.5234110.0859
Module end 'content' 0.01420.1803 880.6094539.2969
Script end 0.1945  1,419.9063 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00442.2619200.0002
Check MTime0.00180.9160200.0001
Mysql Total
Database connection0.00080.394510.0008
Mysqli_queries0.143573.72531410.0010
Looping result0.00130.64761390.0000
Template Total0.179992.410.1799
Template load0.00110.581010.0011
Template processing0.178891.855110.1788
Override
Cache load0.00080.431010.0008
Sytem overhead
Fetch class attribute can translate value0.00120.604710.0012
XML
Image XML parsing0.00030.133510.0003
General
dbfile0.00452.3168200.0002
String conversion0.00000.003130.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs