开发者

CakePHP 2.0 not using my Ajax layout

I am in progress of migrating an app from CakePHP 1.3 to 2.0, and have noticed a pr开发者_高级运维oblem with the ajax parts of my app, in that CakePHP is serving up Ajax responses with the default.ctp layout, and not my ajax.ctp.

Is there anything I need to do in particular to get the ajax layout to work? It's currently located in View/Layouts/ajax.ctp with my default.ctp which works fine.


Did you specify the layout in beforeRender in your controller or app_controller? If so, an easy hack would be $this->autoLayout = false;; or better: call $this->render('view_name','ajax'); at the end of your action.

You probably use RequestHandler (I heard it will automatically use ajax layout for ajax requests, but I rarely use it, so I don't know).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜