你好我使用Smarty的,并试图获得的if/else在TPL其中显示工作{$代码}Smarty的 - PHP的if/else
php文件
$this->_Smarty->assign("License_Key", TRUE);
$Value = '
License Key :
{if $License_Key}
Valid
{else}
Not Valid
{/if}';
$this->_Smarty->assign("Code", $Value);
在TPL文件:
{$Code}
输出为
License Key :
{if $License_Key}
Valid
{else}
Not Valid
{/if}
出认沽应该是:
License Key : Valid
您正在为任何其他Smarty变量分配'$ Value'。你没有告诉Smarty它应该将该片段解释为Smarty模板。 – deceze