Re: [SMARTY] Smarty Config Error

From: Date: Sat, 22 Feb 2003 19:57:25 +0000
Subject: Re: [SMARTY] Smarty Config Error
References: 1  Groups: php.smarty.dev php.smarty.general 
Request: Send a blank email to php-smarty-dev+get-824@lists.php.net to get a copy of this message
Paul Lockaby wrote: > Hi, > > This will fail: > > {config_load file="config/#p_DefaultLanguage#.lang"} > > However, this does not: > > {config_load file="config/$p_DefaultLanguage.lang"} > > Can we get it so that they both work? > Or it could be modified like this in order to avoid doing two additional preg_matches: function _expand_quoted_text($var_expr) { if(preg_match_all('%(?<!\\\\)(\#|\$)(?:smarty(?:\.\w+)+|\w+(?:' . $this->_var_bracket_regexp . ')*)(\#|)%', $var_expr, $match)) { // regular variables rsort($match[0]); reset($match[0]); foreach($match[0] as $var) { if (substr($var,0,1) == "$") { $var_expr = str_replace ($var, '".' . $this->_parse_var($var) . '."', $var_expr); } elseif (substr($var,0,1) == "#" && substr($var,-1) == "#") { $var_expr = str_replace ($var, '".' . $this->_parse_conf_var($var) . '."', $var_expr); } } return preg_replace('!\.""|""\.!', '', $var_expr); } else { return $var_expr; } } Whichever is preferred, they both work.

« previous php.smarty.dev (#824) next »