Re: [SMARTY] config_load

From: Date: Fri, 31 Jan 2003 22:09:30 +0000
Subject: Re: [SMARTY] config_load
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7446@lists.php.net to get a copy of this message
On 31 Jan 2003 at 13:53, Jason M. Yonan wrote: > Hello all! > > I am new to Smarty and have a question about how to load a config file > from a smarty object. The docs seems to point that you can do the > following, but this doesn't seem to be possible with version 2.3.1. > > $smarty = new Smarty; > $smarty->config_load("my.conf"); > As you say this method is not implemented yet in 2.3.1 but will be in the next major release (docs mention 2.4.0). > The latest cvs seems to include this function, but the 2.3.1 version only > has a private function _config_load(). What is the preferred way to load a > config file in the latest stable version? Sorry if I am missing something > obvious. > > Jason Currently you can directly use the Config_File class (see Config_File.class.php). I didn't find the right documentation for this since I don't use config files but I'm sure you will be able to make use of the class API. Alternatively you can use PHP's internal ini-file parser (see docs for parse_ini_file()), but there are some syntax differences: - Comment lines must begin with semicolon (;) - No multiline support - You cannot use " characters in strings ini files are perfect for application configuration such as short strings, flags, bit-fields and numbers. They are parsed very fast, much faster than Smarty's config files and even faster than php scripts. -- Ferdinand Beyer <fbeyer@clickhand.de>

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