Re: [SMARTY] \n in configs files

From: Date: Mon, 29 Jul 2002 13:26:51 +0000
Subject: Re: [SMARTY] \n in configs files
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5495@lists.php.net to get a copy of this message
You can put triple quotes around a value, and newlines will be respected. var = """this is my stuff""" Peter Kmet wrote:
If you want to use "\n" for new line in configs files change Config_File.class.php in function _parse_config_block() change foreach ($config_lines as $line) { if (preg_match("/^\s*(\.?\w+)\s*=(.*)/", $line, $match)) {
    $var_value = preg_replace('/^([\'"])(.*)\1$/', '\2', trim($match[2]));
    $this->_set_config_var($vars, trim($match[1]), $var_value,
$this->booleanize); } } to foreach ($config_lines as $line) { if (preg_match("/^\s*(\.?\w+)\s*=(.*)/", $line, $match)) {
    $var_value = preg_replace('/^([\'"])(.*)\1$/', '\2', trim($match[2]));
    $var_value = str_replace('\n',"\n",$var_value);
    $this->_set_config_var($vars, trim($match[1]), $var_value,
$this->booleanize); } } PS: i'm sure there is better solution for that:-) Peter
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

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