Susanna Posted October 2, 2012 Share Posted October 2, 2012 Hi. First of all sorry for my poor English. I am newbie using Ps, and I am finding a problem while trying to add a new hook. I spent many hours reading documentation and tutorials about how should I do this, but I cannot get the desired result so I am writing to find a little help. I just want to create a new hook for a simple banner, so I followed these steps. 1) Hook creation by adding a record to ps_hooks. My hook is called 'displayBanner'. The record created looks like: 2) FrontController.php - initContent function edition 'HOOK_BANNER' => Module::hookExec('displayBanner') 3) Module (blockadvertising.php) edition: I added: public function hookdisplayBanner($params) { return $this->hookRightColumn($params); } I also tryed with hookDisplayBanner y hookBanner function names. 4) Tpl edition: header.tpl. <div class="grid_50"> <div class="alpha grid_50 omega"> {$HOOK_BANNER} </div> </div> <div class="clear"></div> Module 'moved' to the new hook All seems to be right. Result When I visit the frontend, the place where the module is supposed to be placed is just empty. Please, I need some help. Link to comment Share on other sites More sharing options...
Susanna Posted October 3, 2012 Author Share Posted October 3, 2012 Nobody knows how to create a new hook in 1.5? Link to comment Share on other sites More sharing options...
templatin Posted October 9, 2012 Share Posted October 9, 2012 Hi, Write the below code snippet in: override/classes/controller/FrontController.php class FrontController extends FrontControllerCore { public function initContent() { parent::initContent(); if ($this->context->getMobileDevice() == false){ $this->context->smarty->assign('HOOK_BANNER', Hook::exec('displayBanner')); } } } 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now