Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('_PS_VERSION_'))
- exit;
- class TopMenu extends Module {
- public function __construct()
- {
- $this->name = 'topmenu';
- $this->tab = 'top menu';
- $this->version = '0.3';
- $this->author = 'PrestaShop';
- $this->need_instance = 0;
- parent::__construct();
- $this->displayName = $this->l('Top Menu');
- $this->description = $this->l('Adds a block to display an top menu.');
- }
- public function install(){
- // let's create the hook (if it not exists)
- $hook = new Hook();
- $hook->name = 'top_menu';
- $res = $hook->save();
- // return true on install succeed
- if ($res && parent::install())
- return true;
- return false;
- }
- public function uninstall()
- {
- // uninstall the module will uninstall the hook :)
- $hook = Hook::get('top_menu');
- $res = $hook->delete();
- // return true on uninstall succeed
- if ($res && parent::uninstall())
- return true;
- return false;
- }
- public function hookTop_Menu(){
- // of course, your theme contains {$TOP_MENU} somewhere !
- // feel free to execute any code here
- $a = 1;$b = 2; $c = $a + $b;
- global $smarty;
- // (you can use smarty)
- $smarty->assign('res', $c);
- // or also simple echos (not recommended of course)
- echo "this will be displayed on pages containing {$TOP_MENU} (if I have good memories)";
- }
- }
Add Comment
Please, Sign In to add comment