我有一个基本模板,然后构建子模板。
模板方面:
<header>
{onload;file={var.flag;if [val]=1;then 'nav.tpl';else ''}}
</header>
<main>
{onload;file={var.templatePath}}
</main>
所以main
标签填充了子模板,但标题不是。它是说 ,TinyButStrong Error in field {var.flag...}: the key 'flag' does not exist or is not set in VarRef. (VarRef seems refers to $GLOBALS) This message can be cancelled using parameter 'noerr'.
但实际上它确实与VarRef
一起存在于数组中templatePath
。
php端:
global $templatePath, $flag;
$this->tbs->LoadTemplate($pageTemplateFile);
if(true){$flag = 0;}
$this->tbs->Show();