template proc: allow isolation of var name between [ and ]
$var.name -> $[var.name]
This commit is contained in:
parent
5fc3c3ab85
commit
aef737f376
1 changed files with 4 additions and 2 deletions
|
@ -160,13 +160,15 @@
|
||||||
|
|
||||||
private function var_replace($s){
|
private function var_replace($s){
|
||||||
$m = array();
|
$m = array();
|
||||||
if (preg_match_all('/\$([a-zA-Z0-9-_]+\.*)+/', $s,$m)){
|
if (preg_match_all('/\$\[{0,1}([a-zA-Z0-9-_]+\.*)+\]{0,1}/', $s,$m)){
|
||||||
foreach($m[0] as $var){
|
foreach($m[0] as $var){
|
||||||
$val = $this->_get_var($var, true);
|
$varn = str_replace(array("[","]"), array("",""), $var);
|
||||||
|
$val = $this->_get_var($varn, true);
|
||||||
if ($val!=KEY_NOT_EXISTS)
|
if ($val!=KEY_NOT_EXISTS)
|
||||||
$s = str_replace($var, $val, $s);
|
$s = str_replace($var, $val, $s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue