30ml Posted September 9, 2013 Share Posted September 9, 2013 hi, I am new baby in creating module and I am working on prestashop 1.5.5.0. For testing, I am creating module "mymodule" here, I have create display.php in module/mymodule/controllers/front/display.php <?php class mymoduledisplayModuleFrontController extends ModuleFrontController { public function initContent() { parent::initContent(); $this->setTemplate(dirname(__FILE__).'display.tpl'); } } ?> I have put display.tpl file in module/mymodule/controllers/front/ folder. but it does not work any more. I do not think that I have put tpl file in correct location. Thanks for co-operate, Link to comment Share on other sites More sharing options...
El Patron Posted September 9, 2013 Share Posted September 9, 2013 for front .tpls try ../module/views/templates/front 1 Link to comment Share on other sites More sharing options...
30ml Posted September 10, 2013 Author Share Posted September 10, 2013 for front .tpls try ../module/views/templates/front ya it works. I modified this code in display.php $this->setTemplate('display.tpl'); and I have put display.tpl in views/templates/front folder Link to comment Share on other sites More sharing options...
new_12 Posted February 5, 2014 Share Posted February 5, 2014 (edited) this is my code class mymoduleshowinvoiceModuleFrontController extends ModuleFrontController { public function initContent() { parent::initContent(); if (Tools::getValue('id') != '') $this->setTemplate('template.tpl'); else $this->errors[] = Tools::displayError('You do not have permission to view this.'); } } i put my template.tpl inside views/templates/front folder still its now working.it shows some error like Oops, something went wrong.Try to refresh this page or feel free to contact us if the problem persists. what is this? Edited February 5, 2014 by Dipi.k (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted February 5, 2014 Share Posted February 5, 2014 this is my code class mymoduleshowinvoiceModuleFrontController extends ModuleFrontController { public function initContent() { parent::initContent(); if (Tools::getValue('id') != '') $this->setTemplate('template.tpl'); else $this->errors[] = Tools::displayError('You do not have permission to view this.'); } } i put my template.tpl inside views/templates/front folder still its now working.it shows some error like Oops, something went wrong. Try to refresh this page or feel free to contact us if the problem persists. what is this? if it is possible please continue discussion in one thread: http://www.prestashop.com/forums/topic/283802-link-to-a-pop-up-window-with-size-chart/ Link to comment Share on other sites More sharing options...
nemodylan Posted February 9, 2014 Share Posted February 9, 2014 Hello! I have the same problem. I'm still a beginner. I use Prestashop 1.5.6.2Here is my code in .php the file: controllers/front/mapage.php : <?phpclass newmoduledisplayModuleFrontController extends ModuleFrontController{ public function initContent() { parent::initContent(); $this->setTemplate('mapage.tpl'); }} And in the .tpl file : views/templates/front/mapage.tpl : <h1>Hello World</h1> I created a module and it worked. After I created one with another name, and another class, but it displays a blank page. I need help please! Thanks Link to comment Share on other sites More sharing options...
PascalVG Posted February 9, 2014 Share Posted February 9, 2014 White screen suggests there is some (syntax) error. Turn on debugging mode to get the error. That may help finding the source of the problem http://www.prestashop.com/forums/topic/224525-how-to-turn-on-error-reporting-for-debug-information/ pascal Link to comment Share on other sites More sharing options...
nemodylan Posted February 9, 2014 Share Posted February 9, 2014 Hii!!! Thank you for your help. Everything is clear now. Thank you Cordially. Link to comment Share on other sites More sharing options...
new_12 Posted February 11, 2014 Share Posted February 11, 2014 nemodylan.....how u solved that issue Link to comment Share on other sites More sharing options...
abdess Posted February 12, 2017 Share Posted February 12, 2017 how i solve this problem on prestashop 1.7.0.4 ? Link to comment Share on other sites More sharing options...
stornight Posted May 24, 2017 Share Posted May 24, 2017 (edited) Hi, i have the same problem than 30ml so i put my "display.tpl" file in the "mymodule/views/templates/front" and my controler code is the same has 30ml: <?php class mymoduledisplayModuleFrontControllerextends ModuleFrontController{ public function initContent() { parent::initContent(); $this->setTemplate('display.tpl'); }}?> but prestashop respond : No template found for display.tpl Edited May 24, 2017 by stornight (see edit history) Link to comment Share on other sites More sharing options...
abdess Posted May 24, 2017 Share Posted May 24, 2017 Hi, i have the same problem than 30ml so i put my "display.tpl" file in the "mymodule/views/templates/front" and my controler code is the same has 30ml: <?php class mymoduledisplayModuleFrontControllerextends ModuleFrontController { public function initContent() { parent::initContent(); $this->setTemplate('display.tpl'); } } ?> but prestashop respond : No template found for display.tpl In what folder did you put display.tpl? Link to comment Share on other sites More sharing options...
stornight Posted May 25, 2017 Share Posted May 25, 2017 in the "mymodule/views/templates/front" folder Link to comment Share on other sites More sharing options...
abdess Posted May 25, 2017 Share Posted May 25, 2017 stornight ------------- try like this : $this->setTemplate('module:mymodule/views/templates/front/display.tpl'); and in your template display.tpl {extends file='display.tpl'} 1 Link to comment Share on other sites More sharing options...
stornight Posted May 26, 2017 Share Posted May 26, 2017 it worked well but i don't have the same result than in the tutorial Link to comment Share on other sites More sharing options...
TiaNex Shopping Posted May 27, 2017 Share Posted May 27, 2017 please read setTemplate() function ,you will know where to put your .tpl file, Link to comment Share on other sites More sharing options...
thanhtungtn007 Posted June 1, 2017 Share Posted June 1, 2017 stornight ------------- try like this : $this->setTemplate('module:mymodule/views/templates/front/display.tpl'); i try this, and success. Thank You 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