In my modules config page (backoffice) I want to open Smarty template file, but it should load just tpl content (no Prestashop header, menu etc).
class MyModule extends Module
{
public function getContent()
{
if (Tools::getValue('customAction') === 'displayMyPage')
{
return $this->displayMyPage();
}
$url = $this->context->link->getAdminLink('AdminModules', true,
array('configure' => $this->name, 'customAction' => 'displayMyPage'));
return '<a href="'.$url.'" class="btn btn-danger">Open MyPage</a>';
}
public function displayMyPage()
{
$templateURI = __DIR__.'/views/templates/admin/myPage.tpl';
$output = $this->context->smarty->fetch($templateURI);
}
}
I tried $this->content_only = true
but no luck.
Bit medieval solution but works:
class MyModule extends Module
{
/***
***/
public function displayMyPage()
{
$templateURI = __DIR__.'/views/templates/admin/myPage.tpl';
$output = $this->context->smarty->fetch($templateURI);
// solution: echo and exit
echo $output;
exit;
}
}