开发者

Verbs as CakePHP controllers

开发者 https://www.devze.com 2023-02-28 19:05 出处:网络
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

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

精彩评论

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