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)

Thursday 03 March 2005 9:21:29 am - 11 replies

Author Message

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

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.