diff --git a/NEWS b/NEWS index 566ec795..922ffd36 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ + - handle embedded "$smarty.config.foo.tpl" correctly (Monte) + - add $smarty.config.varname variable for accessing config vars (Paul + Lockaby, Monte) - silence PHP warnings in function.fetch.php (Eduardo, Monte) - added get_config_vars(), same basic functionality as diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 87697428..451ab599 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -1446,7 +1446,7 @@ class Smarty_Compiler extends Smarty { function _expand_quoted_text($var_expr) { // if contains unescaped $, expand it - if(preg_match_all('%(?_var_bracket_regexp . ')*)%', $var_expr, $match)) { + if(preg_match_all('%(?_var_bracket_regexp . ')*)%', $var_expr, $match)) { rsort($match[0]); reset($match[0]); foreach($match[0] as $var) { @@ -1770,6 +1770,14 @@ class Smarty_Compiler extends Smarty { $compiled_ref = '(defined("' . substr($indexes[0],1) . '") ? ' . substr($indexes[0],1) . ' : null)'; break; + case 'config': + array_shift($indexes); + $name = substr($indexes[0], 1); + $compiled_ref = "\$this->_config[0]['vars']"; + if ($name = substr($indexes[0], 1)) + $compiled_ref .= "['$name']"; + break; + default: $this->_syntax_error('$smarty.' . $ref . ' is an unknown reference', E_USER_ERROR, __FILE__, __LINE__); break;