Re: [SMARTY] Global Variable Question

From: Date: Wed, 26 Jun 2002 10:09:15 +0000
Subject: Re: [SMARTY] Global Variable Question
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5025@lists.php.net to get a copy of this message
Avern Williams wrote:
$smarty->display("site_template.tpl"); They all specify the same display template file (it's global template for the entire site). Is there a way for me to define this filename only 1 time in Smarty?
I don't understand. Setting a constant within the auto_prepend file and using the constant whenever display() gets called gives you easy configuration of the template file.
I don't think I can use a config file for this, because the config files set variables to be used by the templates, and I want the template name itself to be a variable. I've read through the information on global variables, but I'm not sure if they can solve this question.
Hmm, I still wonder why you want this. Having defined a default template file name does not free you from calling display(). Another way to use some kind of default would be creating a custom smarty class which overrides display() with a new method using a default parameter: function display($tpl_file = 'site_template.tpl') { return parent::display($tpl_file); } Sorry, could not really figure out what you're requesting. Ulf

« previous php.smarty.general (#5025) next »