For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > July 2004 > global vars in included templates









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author global vars in included templates
Martin Kjeldsen

2004-07-07, 8:59 am

Hi,

I know this is covered allready on the mailinglist, but I can't find any
solution to the problem.

The problem is that sometimes I would like to set variables in templates
that the parent template also is able to access.

The only time I've had this problem is if you only want to include a
template 1 time, but have multiple includes of it. So what I want is a kind
of require_once (of php). This is as far as I know not included in Smarty
and the another way of doing this would be to set a variable in a template
and check that variable everytime the template is included.

Is {assign var="name" value="Bob" global="1"} a good idea? Is {include
file="footer.tpl" once="1"} a good idea? Does anybody know of another way of
doing this?

Thanks...

Martin
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com