Reputation: 125
I am developing a cakephp application, I dont need to use any database tables for my home page, but cake asking for a model and database table, How can I solve this issue ? ( using cakephp 1.3)
Thank you
Upvotes: 10
Views: 15256
Reputation: 7701
You can find the answer from the CakePHP official documentation at https://book.cakephp.org/1.2/en/The-Manual/Developing-with-CakePHP/Controllers.html:
If you do not wish to use a Model in your controller, set var $uses = array(). This will allow you to use a controller without a need for a corresponding Model file.
Upvotes: 0
Reputation: 949
For anybody having the same problem in CakePHP 3.0+, this is what works for me:
class MyController extends AppController {
public function initialize() {
parent::initialize();
$this->modelClass = false;
}
}
Upvotes: 7
Reputation: 708
For anybody having the same problem in 2.1+ (despite what docs says), this is what works for me:
public $uses = null;
Upvotes: 4
Reputation: 181
I'm not sure what version was being used but for me, on 1.3.6, $uses
is an array.
class MyController extends AppController {
var $uses = array();
}
Details can be seen here: 3.5.3.2 $components, $helpers and $uses
Upvotes: 11
Reputation: 60526
Simply set $uses of your controller to false, like so
class MyController extends AppController {
var $uses = false;
}
Or put your view inside app/views/pages/home.ctp
Upvotes: 15