astekx Posted June 16, 2014 Share Posted June 16, 2014 Hi, i want to create very simple module to display my custom menu. Now I'm on stage to display only simple information but I don't succed. I have 2 files: mymodule.php <?php if (!defined('_PS_VERSION_')) exit; class MyModule extends Module { public function __construct() { $this->name = 'mymodule'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'Firstname Lastname'; $this->need_instance = 0; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('My module'); $this->description = $this->l('Description of my module.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('MYMODULE_NAME')) $this->warning = $this->l('No name provided'); } public function install() { if (!parent::install() || !$this->registerHook('Glemenu') || !Configuration::updateValue('MYMODULE_NAME', 'my friend') ) return false; return true; } public function uninstall() { if (!parent::uninstall()) return false; return true; } public function hookDisplayGlemenu() { return $this->display(__FILE__, 'mymodule.tpl'); } } mymodule.tpl <!-- Block mymodule --> <div id="mymodule_block_home" class="block"> <h4>Welcome!</h4> <div class="block_content"> <p>Hello, {l s='Click this link' mod='mymodule'} </p> <ul> <li><a href="#" title="Click this link">Click me!</a></li> </ul> </div> </div> <!-- /Block mymodule --> and I want to display it in header {hook h='displayGlemenu'} and after installing, it does not appear on the module list. I looked into /modules folder and this two files are in the main /modules folder (not in modules/mymodule). And what is most important it doesn't work. What I'm doing wrong? Link to comment Share on other sites More sharing options...
vekia Posted June 16, 2014 Share Posted June 16, 2014 instead of {hook h='displayGlemenu'} try to use {Hook:exec('displayGlemenu')} Link to comment Share on other sites More sharing options...
astekx Posted June 16, 2014 Author Share Posted June 16, 2014 When I changed it to {Hook:exec('displayGlemenu')} page was white - not displaying anything. What is strange - when I install module it says that everything is ok, but module doesnt appear on module list and these 2 files are not in their catalog as rest of modules but directly in modules - modules/mymodule.php and modules/mymodule.tpl 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