template proc: avoid a notice and allow template name to include to be passed with a variable value

This commit is contained in:
Fabio Comuni 2012-03-01 11:32:49 +01:00
parent a26ce7c56b
commit c462ed9fc5

View file

@ -116,7 +116,15 @@
* {{ inc <templatefile> [with $var1=$var2] }}{{ endinc }} * {{ inc <templatefile> [with $var1=$var2] }}{{ endinc }}
*/ */
private function _replcb_inc($args){ private function _replcb_inc($args){
if (strpos($args[2],"with")) {
list($tplfile, $newctx) = array_map('trim', explode("with",$args[2])); list($tplfile, $newctx) = array_map('trim', explode("with",$args[2]));
} else {
$tplfile = trim($args[2]);
$newctx = null;
}
if ($tplfile[0]=="$") $tplfile = $this->_get_var($tplfile);
$this->_push_stack(); $this->_push_stack();
$r = $this->r; $r = $this->r;
if (!is_null($newctx)) { if (!is_null($newctx)) {