Jump to content

[1.5.4] New hooks in FrontController work only if placed in initHeader()?


stratboy

Recommended Posts

Hi. I created new hooks and assigned to smarty in an overridden frontcontroller.

I wanted to place them in init() or displayHeader(), but it simply doesn't work. I have to place theme in initHeader() instead.

 

Class FrontController extends FrontControllerCore{

   public function initHeader(){

       $this->context->smarty->assign('HOOK_HEADER_TOOLS', Hook::exec('displayHeaderTools'));
       $this->context->smarty->assign('HOOK_HEADER_RIGHT_BOX', Hook::exec('displayHeaderRightBox'));
       $this->context->smarty->assign('HOOK_HEADER_MAINMENU_BOX', Hook::exec('displayHeaderMainMenuBox'));

       parent::initHeader();
   }

}//end FrontController

 

Why aren't they recognized if I put them in init() or displayHeader()?

 

(I would receive a smarty Notice like Undefined index [..] Trying to get property of non-object [...] etc--)

Link to comment
Share on other sites

Hi,

 

If you check initial FrontController::displayHeader code, you will see that this method is depricated and the most likely is not used on the necessary page.

 

Best regards.

 

Hi! You're right!

 

And what about using the init() method? Why doesn't it work?

Link to comment
Share on other sites

Hi,

 

It is hard to say. It is necessary to check the whole code and see the definite case. init() is not the method which should be reloaded. initContent() is better.

 

Best regards.

 

initContent().. Yesss, interesting, thank you!!! :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...