开发者

how to enable layout in XmlHttpReeuqest in symfony

开发者 https://www.devze.com 2022-12-31 20:37 出处:网络
Symfony detects if it receives a XmlHttpRequest and automatically turns off your debug bar and layout. However I\'d like 开发者_如何学运维to have the response decorated with a specified layout. Also I

Symfony detects if it receives a XmlHttpRequest and automatically turns off your debug bar and layout. However I'd like 开发者_如何学运维to have the response decorated with a specified layout. Also I don't want to add custom line of code in the action to enable the layout, I wish I can just make a configuration through yml files.

Thanks in advance.


You might be able to override the turning layout off with a custom view.yml for your module.

apps/frontend/modules/yourmodules/config.yml

ajaxSuccess:
  has_layout:     true
  layout:         theajaxlayout

However I am not sure that will be possible and you might have to do it in your action.

$this->setLayout("theajaxlayout");
0

精彩评论

暂无评论...
验证码 换一张
取 消