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 :)

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 21 2025 17:22:59
Script start
Timing: Jan 21 2025 17:22:59
Module start 'layout'
Timing: Jan 21 2025 17:22:59
Module start 'content'
Timing: Jan 21 2025 17:22:59
Module end 'content'
Timing: Jan 21 2025 17:22:59
Script end

Main resources:

Total runtime0.0135 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0042 591.8750151.2109
Module start 'layout' 0.00420.0030 743.085936.6641
Module start 'content' 0.00720.0049 779.750098.1719
Module end 'content' 0.01210.0014 877.921941.9922
Script end 0.0135  919.9141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002115.4366140.0001
Check MTime0.00097.0050140.0001
Mysql Total
Database connection0.00064.766310.0006
Mysqli_queries0.002820.507630.0009
Looping result0.00000.074010.0000
Template Total0.00107.510.0010
Template load0.00075.377510.0007
Template processing0.00032.053810.0003
Override
Cache load0.00053.730610.0005
General
dbfile0.00107.408380.0001
String conversion0.00000.052840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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