你好我使用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