Forums / Setup & design / Set variables across templates

Set variables across templates

Author Message

Marin Orlic

Tuesday 23 August 2005 9:05:47 am

Hi all,

I need to pass some parameters to my template overriding

standard/content/datatype/ezxmltags/link.tpl

to generate different links for some subtrees (newsletters to be exact). How can this be done, and can it be done at all? I've tried setting some variables in pagelayout template, but they're not accessible.. setting parameters to attribute_view_gui would also be acceptable, but how to propagate this to the template itself?

Thx.

Felix Laate

Wednesday 24 August 2005 4:26:07 am

Hi Marin!

Why not use this: http://ez.no/products/ez_publish_cms/documentation/customization/custom_design/user_specified_parameters

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Xavier Dutoit

Wednesday 24 August 2005 8:10:30 am

Hi,

How are you using the template ? from a php program ?

you can probably assign a template variable root_link from the php and access it from the link.tpl $#root_link

The content is computed before the pagelayout, that's why you can't access the variable if you set it in pagelayout.

Don't forget to clear the template cache each time, otherwise you're going to have bad surprises.

Good luck

X+

http://www.sydesy.com

Marin Orlic

Thursday 25 August 2005 11:58:19 am

Hi Felix!

I cannot use user params this way, since I'm trying to pass some data to internal templates used to render a datatype (link tags within ezxml text).. they don't see any of these, afaik.

Marin Orlic

Thursday 25 August 2005 12:17:45 pm

Hi Xavier,

I'm doing something like:

{def data=10}

{attribute_view_gui attribute=$object.data_map.xmltext}

I'd like to have the ability to use that data to render links in some other way..

I've also tried to pass params to attribute_view_gui but it also doesn't work.

Which template variables are set for the link.tpl template? In ezxhtmlxmloutput.php handler, I can see only 'href', 'target', 'classification', 'title', and 'id' ... which are of no use so far :(

Marin Orlic

Thursday 25 August 2005 2:50:11 pm

Hi all,

ok, this seems to work - set the variable to root namespace with a set-block (def doesn't work somehow?!):

{set-block scope=root variable=data}10{/set-block}

and then use it in the link template as:

{$#data}

I know that this isn't too clever, but I've been using def and that didn't work..

Marko Žmak

Thursday 25 August 2005 3:54:15 pm

Does it work with {set} insetad of {set-block}? Try it.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Xavier Dutoit

Friday 26 August 2005 12:08:51 am

Hi Marin,

I don't get why you find "not too clever" to use set-block.

About the def, you don't define the namespace ?

If you set the scope on the def, it should work too.

X+

http://www.sydesy.com

Marin Orlic

Friday 26 August 2005 2:37:25 am

I tried to set the scope on def and got some parse error (expected $ instead of scope=...).

About the clever part - I should've tried set and set-block first :)