Re: [SMARTY] Re: multiple config dirs

From: Date: Thu, 13 Mar 2003 14:08:26 +0000
Subject: Re: [SMARTY] Re: multiple config dirs
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8617@lists.php.net to get a copy of this message
On Thu, Mar 13, 2003 at 03:00:51PM +0100, atu wrote: > Hi, > It would be greate if the Smarty developers would post any comments on > Hinrich Donner's implementation to handle multiple config dirs. i think there will be no new features for 2.5.0, just bugfixes. maybe after 2.5.0-final this could be integrated. i'm not that deep in the config-file handling (i don't use them that heavily) but i have no problem with it. Monte, you? greetings messju > atur > > ----------------------- > Hinrich Donner wrote: > > I have implemented something simple that enables multiple configuration > directories. At the moment I do not know if there are side effects. > > I create a class with constructor derived from Smarty. I implemented the > following method: > > /** > * Config Load > * > * This method overwrite the original Smarty method. It enables the use > * of multiple configuration files. The directories are processed in > * order they are stored in the array. > * > * @param string $file The file name located in one of the directories > * @param string $section The section in the configuration file > * @param string $scope The scope for the variables > * @see Smarty::config_load() > * @todo Look for side effects with Smarty. > */ > function config_load($file, $section = null, $scope = 'global') > { > // If we do not have an array, we can proceed the normal method. > // > if (!isset($this->config_dirs) || !is_array($this->config_dirs)) > return parent::config_load(&$file, &$section, &$scope); > > // Now we have to move through the directories. > // > reset($this->config_dirs); > foreach ($this->config_dirs as $config_dir) > { > $this->config_dir = $config_dir; > parent::config_load(&$file, &$section, &$scope); > } > } > > To define the directories use (mind the last 's') > > $smarty->config_dirs = array('foo/', 'bar/'); > > In this case, the variable $smarty->config_dir wil NOT be processed! > > Hinrich > > -- > Hinrich Donner > > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- HTML-Programmierer: Grafiker Kristian Köhntopp

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