PHP 智能变量错误


PHP smarty variable error

我有这个错误

" 注意:未定义的变量:C:''WAMP''WWW''SITE''TOOLS''SMARTY''SYSPLUGINS''SMARTY_INTERNAL_DATA 中的徽标。第 291 行调用堆栈上的 PHP"

这是我的PHP代码

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>

谁能帮助我做错了什么?感谢!!!

您可以修改 PHP 代码以确保设置$logo,例如:

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');
}

另请注意,}后不需要分号。