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

eZ debug

Timing: Jan 21 2025 06:08:16
Script start
Timing: Jan 21 2025 06:08:16
Module start 'content'
Timing: Jan 21 2025 06:08:16
Module end 'content'
Timing: Jan 21 2025 06:08:16
Script end

Main resources:

Total runtime0.1895 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.0072 587.7266180.8359
Module start 'content' 0.00720.0050 768.5625101.8984
Module end 'content' 0.01220.1772 870.4609530.3047
Script end 0.1894  1,400.7656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00402.0988200.0002
Check MTime0.00140.7312200.0001
Mysql Total
Database connection0.00100.548910.0010
Mysqli_queries0.136572.03141410.0010
Looping result0.00150.79691390.0000
Template Total0.176893.310.1768
Template load0.00090.463010.0009
Template processing0.176092.875810.1760
Override
Cache load0.00060.332610.0006
Sytem overhead
Fetch class attribute can translate value0.00100.518910.0010
XML
Image XML parsing0.00030.145710.0003
General
dbfile0.00774.0538200.0004
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