简体   繁体   English

Prestashop从模块禁用布局

[英]Prestashop disable Layout from module

I've created an API module in prestaShop and I am generating an XML output to a certain CMS page. 我在prestaShop中创建了一个API模块,并且正在生成XML输出到某个CMS页面。 Thing is that I can't disable the layout. 问题是我不能禁用布局。 I just need to render the XML output from the module (and no html) . 我只需要呈现模块(而不是html)的XML输出。 Any ideas please? 有什么想法吗? (I am not using the webservice classes) (我没有使用webservice类)

At least.. Is it possible to do this from a module? 至少..是否可以通过模块执行此操作?

Thanks, Dan 谢谢,丹

Override the method "display" of your controller and output whatever you want. 覆盖控制器的方法“ display”并输出所需的任何内容。

If you do not want to display layout, do not call parent::display(). 如果您不想显示布局,请不要调用parent :: display()。

I have a problem like you. 我有像你这样的问题。 And I knew how to disable it. 而且我知道如何禁用它。

You just need add two lines below to your module: 您只需要在模块下面添加两行即可:

$this->display_header = false;
$this->display_footer = false;

Example: 例:

public function initContent(){
   parent::initContent();
   $this->display_header = false;
   $this->display_footer = false;
   $this->setTemplate('display.tpl');
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM