How to insert a module in header.tpl
file in opencart 2.0 ?
I have a module. Does not have the layout position option for that module.
So i need to place that manually in header.tpl
file.
I am already tried this but not working for opencart 2.0.
Please any one help me.
Thanks
In opencart 2.0 or above you can load the contoller of module :-
$data['anyname'] = $this->load->controller('modulefolder/filename');
And In that module's controller file there should be a return of what it render.Like:
return $this->load->view('default/template/modulefolder/filename.tpl', $data);
Your code is wrong
$['special_block'] = $module = $this->getChild('module/special', array(
'limit' => 5,
'image_width' => 80,
'image_height' => 80
));
For example you have a custom module named "testmodule" under common folder
if you want to insert this module in header you need to do following thing
Load controller on catalog/controller/common/header.php
$data['testmodule'] = $this->load->controller('common/testmodule');
Echo the following code on header template file i.e. view/theme/default/template/common/header.tpl
<?php echo $testmodule; ?>
This will work