PHP smarty 变量错误 [英] PHP smarty variable error
本文介绍了PHP smarty 变量错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个错误
注意:未定义变量:LOGO IN C:\WAMP\WWW\SITE\TOOLS\SMARTY\SYSPLUGINS\SMARTY_INTERNAL_DATA.PHP ON LINE 291 CALL STACK"
" NOTICE: UNDEFINED VARIABLE: LOGO IN C:\WAMP\WWW\SITE\TOOLS\SMARTY\SYSPLUGINS\SMARTY_INTERNAL_DATA.PHP ON LINE 291 CALL STACK"
这是我的 PHP 代码
Here is my PHP code
function hookFooter($params)
{
global $smarty;
$smarty->assign('ENT_QUOTES', ENT_QUOTES);
if( file_exists('modules/ebbrandingfooter/logo-footer.jpg')){
$smarty->assign('logo','modules/ebbrandingfooter/logo-footer.jpg');
};
$FOOTERdescription=Configuration::get('FOOTER_DESC');
$smarty->assign('description',$FOOTERdescription );
return $this->display(__FILE__, 'ebbrandingfooter.tpl');
}
这里是 TPL
{if $logo}<img src="{$logo}" />{/if}
<p>{$description}</p>
任何人都可以帮助我做错什么吗?谢谢!!!
Can anyone help me what I am doing wrong? THX!!!
推荐答案
您可以修改 PHP 代码以确保设置了 $logo,例如:
You could modify your PHP code to ensure that $logo is set, e.g:
function hookFooter($params)
{
global $smarty;
$smarty->assign('ENT_QUOTES', ENT_QUOTES);
if( file_exists('modules/ebbrandingfooter/logo-footer.jpg')){
$smarty->assign('logo','modules/ebbrandingfooter/logo-footer.jpg');
} else {
$smarty->assign('logo', null);
}
$FOOTERdescription=Configuration::get('FOOTER_DESC');
$smarty->assign('description',$FOOTERdescription );
return $this->display(__FILE__, 'ebbrandingfooter.tpl');
}
另请注意,在 }
之后不需要分号.
Also note that after a }
you don't need a semicolon.
这篇关于PHP smarty 变量错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文