blasto Posted November 18, 2009 Share Posted November 18, 2009 Bonjour,J'essaye de greffer le module "menu horizontal" http://www.julien-breux.com/2009/08/25/menu-horizontal-v-1-0/ de Julien BREUX, sur un HOOK que j'ai placé dans la div "header"; mais pas moyen ...Voici ce que j'ai fais :J'ai lancé un fichier instal afin de renseigner la base, comme suit : <?php include(dirname(__FILE__).'/config/config.inc.php'); include(dirname(__FILE__).'/init.php'); # ps_access if (!Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'hook` (`id_hook`, `name`, `title`, `description`, `position`) VALUES ("", "Hookmenu1", "Hookmenu1", "Hook pour le menu du haut", "1")')) return false; ?> La base a bien été renseignéePuis j'ai modifier le fichier blocktopmenu.php en rajoutant après : public function hookHeader($params) { global $smarty; $this->makeMenu(); $smarty->assign('MENU_SEARCH', Configuration::get('MOD_BLOCKTOPMENU_SEARCH')); $smarty->assign('MENU', $this->_menu); $smarty->assign('this_path', $this->_path); return $this->display(__FILE__, 'blocktopmenu.tpl'); } Ceci : public function Hookmenu1($params) { global $smarty; $this->makeMenu(); $smarty->assign('MENU_SEARCH', Configuration::get('MOD_BLOCKTOPMENU_SEARCH')); $smarty->assign('MENU', $this->_menu); $smarty->assign('this_path', $this->_path); return $this->display(__FILE__, 'blocktopmenu.tpl'); } J'ai ensuite modifier le fichier header.php en ajoutant après : 'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn'), Ceci : 'HOOKMENU1' => Module::hookExec('Hookmenu1'), Puis j'ai rajouté le Hook dans mon fichier header.tpl, dans la div "header" : {$HOOKMENU1}Enfin, j'ai activé le module et je l'ai greffé sur le hook : "Hookmenu1"Mais voilà, rien ne s'affiche ...Help svp :) Link to comment Share on other sites More sharing options...
SotEW Posted November 18, 2009 Share Posted November 18, 2009 salut,la fonction qui doit être présente dans le fichier blocktopmenu.php et qui doit renvoyer le code pour le hook doit avoir pour nom :hookNomduhook.dans le cas présent, ça doit être hookHookmenu1Donc : public function hookHookmenu1($params) { global $smarty; $this->makeMenu(); $smarty->assign('MENU_SEARCH', Configuration::get('MOD_BLOCKTOPMENU_SEARCH')); $smarty->assign('MENU', $this->_menu); $smarty->assign('this_path', $this->_path); return $this->display(__FILE__, 'blocktopmenu.tpl'); } de plus, par convention, ton nom de hook devrait commencer par une lettre minuscule, ainsi je te conseil le nom "menu1" au lieu de "Hookmenu1" (ce qui donnera une fonction hookMenu1, la première lettre du hook prenant une majuscule. Mais bon, les fonctions php ne sont pas case-sensitive, donc ça n'a d'importance que pour le confort de lecture du code.)Sinon, le reste des modifications me semble convenables. Link to comment Share on other sites More sharing options...
blasto Posted November 18, 2009 Author Share Posted November 18, 2009 çà marche !Merci 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