galactic Posted June 24, 2012 Share Posted June 24, 2012 (edited) below is sample code mymodule.php: <?php if (!defined('_CAN_LOAD_FILES_')) exit; class MyModule extends Module { function __construct() { $this->name = "mymodule"; $this->version = "1.0"; $this->author = "Sammy"; $this->tab = "front_office_features"; $this->_postErrors = array(); parent::__construct(); $this->displayName = $this->l("My Module Name"); $this->description = $this->l("This is my module description."); } protected function setConfig($key,$value) { return Configuration::updateValue($this->name.$key,$value,true); } protected function getConfig($value) { return Configuration::get($this->name.$value); } protected function deleteConfig($value) { return Configuration::deleteByName($this->name.$value); } function install() { if (!parent::install() OR !$this->registerHook('home') OR !$this->registerHook('footer') ) return false; return true; } public function uninstall() { parent::uninstall(); return true; } public function hookHome($params) { } public function hookfooter($params) { } private function _postProcess() { $this->_html .= '<div class="conf confirm">'.$this->l("Updated")."</div>"; } public function getContent() { $this->_html .= "<h2>".$this->displayName."</h2>"; if (Tools::isSubmit("submit")) { $this->_postProcess(); } $this->_displayForm(); return $this->_html; } private function _displayForm() { $this->_html .= '<form action="'.$_SERVER['REQUEST_URI'].'" method="post"> <fieldset> <legend><img src="../modules/scroller/logo.gif" alt="" class="middle" />'.$this->l('Settings').'</legend> <br /> <center><input type="submit" name="submit" value="'.$this->l('Upgrade').'" class="button" /></center> </fieldset> </form>'; } } 1. I need to add there mymodule.tpl template, which contain main html code, i.e. return $this->display(__FILE__, 'mymodule.tpl'); Where to add this code? 2. in which place in mymodule.php I should add js and css files that are linked in head tag like this: public function hookHeader() { Tools::addJS($this->_path.'js/myjscript1.js'); Tools::addJS($this->_path.'js/myjscript2.js'); Tools::addCSS($this->_path.'css/mymodule.css', 'all'); } Edited June 26, 2012 by galactic (see edit history) 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