开发者

Verbs as CakePHP controllers

Typically you are supposed to use a plural form of the Model you are using for a controller (eg: UsersController is for the User model, which corresponds with the users table). However, I want to add a controller that isn't really associated with any model or table, like a "Getting Started" set of pages.

开发者_如何学C

I just wonder what the preferred way of handling something like this is for CakePHP.


If those are static pages, put them in views/pages/ and access them via /pages/xyz. This uses the standard PagesController. If you want to make shorter routes instead of /pages/..., create new routes in config/routes.php (the default / route shows an example).

If they are dynamic pages and need a real controller, name it whatever you want.


you can always do that. just make sure you set the $uses array correctly

var $uses = array();

if you dont need any model or

var $uses = array('MyModel');

if you want to use a particular model in this controller

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜