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

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