Share » Forums » Developer » Define variables in pagelayout.tpl,...

Define variables in pagelayout.tpl, access in templates?

Define variables in pagelayout.tpl, access in templates?

Wednesday 13 April 2005 1:54:36 pm - 8 replies

Author Message

Eivind Marienborg

Wednesday 13 April 2005 10:18:27 pm

I've never tried this, so I might be far off, but you could check out set-blocks:
http://www.ez.no/ez_publish/documentation/reference/template_functions/variables/set_block

And namespaces:
http://www.ez.no/ez_publish/documentation/development/libraries/ez_template/basics/namespaces

Craig Hirsch

Thursday 14 April 2005 11:10:11 am

Yup -- set_block seems like it should work, but it doesn't, if you're setting the var in the pagelayout and trying to access it from within $module_result.

Likewise with namespaces -- no success there either.

--
chirsch{AT}gmail{d.t}com

Kristian Hole

Thursday 14 April 2005 2:59:31 pm

The point here is that the module (example content) is run first. This means that if you set a variable in the pagelayout this will be set after your content view _already_ is rendered.

What are you trying to do? If these are sitedefault variables, the wise thing to do is to put it in a inifile and use the templateoperator ezini to read the values from there.

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Craig Hirsch

Thursday 14 April 2005 6:42:18 pm

Kristian, thanks for the inifile suggestion. That's actually exactly how I solved the problem -- I just declared a custom settings area in my site.ini.append, then stuck all of the required values in there.

--
chirsch{AT}gmail{d.t}com

Kristian Hole

Friday 15 April 2005 12:10:05 am

Good :)

Or if you want to, you might as well create a new inifile, and use the settings from that separate file.

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Xavier Dutoit

Friday 15 April 2005 4:58:35 am

Hi,

I have a problem related, but the otherway around:

In the content view, I want to set a global variable, so I can read it from pagelayout.

It works fine the first time, but (if I'm right) once the template is compiled, the content view doesn't set the global variable anymore.

Any idea ?

X+

http://www.sydesy.com

zaxofeel .v

Saturday 07 May 2005 7:34:24 am

just a simple question if you please:

is it possible to declare a variable in a template
like this
{set myvar=$node.node_id}

then call it in another page like that
{$myvar} ??

kracker (the)

The Doctor

Saturday 07 May 2005 7:47:48 pm

I could choke on these words, but ...
I thought that this was the problem that was causing all this strife ...

Xavier just mentioned it (above), that it was still in dier need of a clean room solution that didn't mean hacking apart your own life.

 It works fine the first time, but (if I'm right) once the template is compiled, the content view doesn't set the global variable anymore. Any idea ? X+
________________________
Please help me on to find a cache resistant method to exchange parameters between templates :
http://www.ez.no/community/forum/developer/how_to_exchange_parameters_between_several_parts_blocks_on_a_page

hrmm...
//kracker

<i>atmosphere : my song
sage francis : inherited scars</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu