Jump to content

including tpl in front controller module


30ml

Recommended Posts

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

  • 4 months later...

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 by Dipi.k (see edit history)
Link to comment
Share on other sites

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

Hello!

 

I have the same problem. I'm still a beginner. I use Prestashop 1.5.6.2

Here is my code in .php the file:
controllers/front/mapage.php :

 

 

<?php
class 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

  • 3 years later...
  • 3 months later...

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 by stornight (see edit history)
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...