Forums / Developer / how to show a variable in an other template?

how to show a variable in an other template?

Author Message

ZRIBI Anoir

Tuesday 30 March 2010 7:04:25 am

hi everybody;

i have 2 templates in:

/design/my_site/override/templates/template1.tpl

/design/my_site/override/templates/template2.tpl

i define my var in template1.tpl, i want to show it in template2.tpl.

please help.

thank you.

Guillaume Kempfer

Wednesday 31 March 2010 1:25:05 am

Does your template1.tpl call your template2.tpl ?

In this case you can pass variable to template2.tpl when you call it.
An an example if template2.tpl is a view line :

{node_view_gui content_node=$mynode view='line' myvar='foo' myvar2='bar'}

You can do the same way with a template include

{include uri="design:template2.tpl" myvar='foo' myvar2='bar'}

ZRIBI Anoir

Wednesday 31 March 2010 6:18:12 am

hi :)

no the template1.tpl call not the second template.

thank you for help.