我正在使用cakephp版本2.6。我的主要问题只是渲染了动作的视图,但没有应用布局。它正在发生在整个行动上。是否是服务器问题我已经在应用程序控制器中应用了默认布局.php但仍然无法正常工作
public function beforeFilter() {
$this->layout = 'default';
}
提前谢谢。
如果使用 default.ctp 作为默认布局方式,则不希望包含以下行。
$this->layout = 'default';
因为 cakephp 默认渲染为"default.ctp
"布局。
如果你想要一些其他的布局" someotherlayout.ctp
"
调用方法
$this->layout = 'someotherlayout';
假设,您不需要布局,并且需要一些没有布局的主要内容。确保布局文件夹中的" ajax.ctp
"。
$this->layout = 'ajax';
假设,您不需要布局,并且需要一些没有布局的主要数据。
$this->autoRender = false;
//provide the data or redirect some other page