In indexController I have this
public function initContent()
{
//echo"asdsad";exit;
parent::initContent();
$this->context->smarty->assign('HOOK_HOME1', Hook::exec('displayHome'));
$this->setTemplate(_PS_THEME_DIR_.'index.tpl');
}
但我不明白。什么是$this->context->smarty->assign
,什么是Hook
?
答案 0 :(得分:3)
assign
公开可以在smarty模板中使用的变量。 Hook::exec('displayHome')
执行名为displayHome
的挂钩,然后将结果分配给名为HOOK_HOME1
的变量。
看看Smarty documentation。还有一个prestashop挂钩列表here