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
1 changed files with 9 additions and 1 deletions

View File

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