global vars in included templates
| From: | Martin Kjeldsen | Date: | Wed, 07 Jul 2004 09:36:44 +0000 |
| Subject: | global vars in included templates | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-11532@lists.php.net to get a copy of this message | ||
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