how to define a variable that can be read in every template

Author Message

Lisa Pini

Thursday 24 July 2008 8:28:40 am

Hello,
I'd like to define a variable that can be read in every template.
Is it possible? Where I must define it?

Now I'm trying to read a value in pagelayout.tpl, folder.tpl and menu.tpl

If I define my variable as global in pagelayout, menu read it correctly, but folder not.
I have read a topic that explains how to do it with persistent variables.
(this is the post: http://ez.no/developer/forum/setup_design/scope_namespace_variable_pagelayout_templates_how_to )
I defined my variable as persistent in folder.tpl and it can be accessed correctly within pagelayout.tpl, but now I have problems with it in menu.tpl and folder.tpl.

How can I solve it?
I suppose that I can define the variable as persistent in folder (to read in pagelayout), and redefine it as global in pagelayout (to read in menu), but this solution is contorted...

Thanks

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 18 2025 21:05:58
Script start
Timing: Jan 18 2025 21:05:58
Module start 'layout'
Timing: Jan 18 2025 21:05:58
Module start 'content'
Timing: Jan 18 2025 21:05:58
Module end 'content'
Timing: Jan 18 2025 21:05:58
Script end

Main resources:

Total runtime0.0173 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.0077 588.1719152.6563
Module start 'layout' 0.00770.0041 740.828139.5078
Module start 'content' 0.01180.0037 780.335985.2891
Module end 'content' 0.01550.0017 865.625030.3047
Script end 0.0172  895.9297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002414.1077140.0002
Check MTime0.00116.2340140.0001
Mysql Total
Database connection0.001910.715310.0019
Mysqli_queries0.004526.229330.0015
Looping result0.00000.086910.0000
Template Total0.00148.310.0014
Template load0.00084.434410.0008
Template processing0.00073.843710.0007
Override
Cache load0.00053.177110.0005
General
dbfile0.00020.957880.0000
String conversion0.00000.051140.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