Config Variables - Loading Multiple Sections at Once
| From: | Alex | Date: | Tue, 29 Apr 2003 09:53:27 +0000 |
| Subject: | Config Variables - Loading Multiple Sections at Once | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9413@lists.php.net to get a copy of this message | ||
I personally find the Config_File class very handy to use in places where I don't use smarty, since I do not always need templating. Hence, I have stumbled upon a limitaion of loading only one section per call, which has driven me into the development of a small function to allow multiple section listing. I propose for a small change to be included in the future official distributions.
Bear in mind this is a quick hack
//language file processing
$conf = new Config_File("../" . CONF_ADMIN_ROOT);
loadLangSection("errors|main");
/**
* loadLangSection() - enables multi-section loading
*
* @param $section
* @return
*/
function loadLangSection($section = NULL){
global $lang, $conf;
if($section){
$section = explode("|",$section);
foreach($section as $block){
$lang = array_merge($lang,$conf->get('en.lang',$block));
}
}
}