I wrote a module, it work if I use return 'Hello World'; but does not work if I use return $this->display(__FILE__, 'mymodule.tpl');
Error:
What is the problem?
Thanx for help!
The code:
<?php if (!defined('_PS_VERSION_')) exit; class MyModule extends Module { public function __construct() { $this->name = 'mymodule'; /* This is the 'technic' name, this should equal to filename (mycustommodule.php) and the folder name */ $this->tab = 'front_office_features'; /* administration, front_office_features, etc */ $this->version = '1.0.0'; /* Your module version */ $this->author = 'Kropatics'; /* I guess it was clear */ $this->need_instance = 0; /* If your module need an instance without installation */ $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); /* Your compatibility with prestashop(s) version */ $this->bootstrap = true; /* Since 1.6 the backoffice implements the twitter bootstrap */ $this->displayName = $this->l('My module'); /* This is the name that merchant see */ $this->description = $this->l('This is my first module.'); /* A short description of functionality of this module */ //$this->context->controller->addCSS($this->_path.'assets/css/mymodule.css', 'all'); } public function initContent() { $this->context->smarty->assign('message', 'hello'); $this->context->controller->addCSS($this->_path.'assets/css/mymodule.css', 'all'); parent::initContent(); } public function initContent() { $this->context->smarty->assign('message', 'hello'); $this->context->controller->addCSS($this->_path.'assets/css/mymodule.css', 'all'); parent::initContent(); } public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } return parent::install() && $this->registerHook('leftColumn') && Configuration::updateValue('MYMODULE_NAME', 'mymodule'); } public function uninstall() { return parent::uninstall(); } public function hookDisplayLeftColumn($params) { //return 'Hello World'; 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, {if isset($message) && $message} {$message} {else} Nincs üzenet! {/if} ! </p> </div> </div> <!-- /Block mymodule -->