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

But I don't understand. What is $this->context->smarty->assign, and what is Hook?

4

1 回答 1

4

assign公开可以在 smarty 模板中使用的变量。Hook::exec('displayHome')执行名为 的钩子displayHome,然后将结果分配给名为 的变量HOOK_HOME1

查看Smarty 文档这里还有一个可用的 prestashop 钩子列表

于 2013-05-13T11:53:17.367 回答