CakePHP: controller without model

Having a controller without a model in CakePHP is very simple: just declare the variable $uses=null in the controller.

class MycoolsController extends AppController{
var $name="Mycools";
var $uses = null;


4 thoughts on “CakePHP: controller without model

  1. Well, I tried this one. But what if, i want to use external models and i _have_ to use $uses? Such as $uses = array(‘Html’, ‘Javascript’); ?

  2. mfkabir says:

    this is my controller

    class BooksController extends AppController{
    var $name=’Books’;
    var $uses=array();

    function index($id=0){
    $this->set(‘page_heading’,’Packt Book Store’);
    $books = array(
    ‘book_title’=>’Object Oriented Programming with PHP5’,
    ‘author’=>’Hasin Hayder’,
    ‘release_date’=>’December 2010’
    ‘book_title’=>’Building Websites with Joomla! 1.0’,
    ‘author’=>’Hagen Graf’,
    ‘release_date’=>’March 2006′
    $this->pageTitle=’Welcome to the PACKT book store!’;

    and this is my view:

    Release Date:

    but when i want to access books/1 url an error shows.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s