Problems with todo Application.

3 messages Options
Embed this post
Permalink
karlo

Problems with todo Application.

Reply Threaded More More options
Print post
Permalink
I'm running cakePHP version 1.2.3.8166 on windows XP with Apache, PHP version 5.2.0.

I can get everything set up and running, and have worked through the "15 minute blog tutorial" on the cakePHP site.  A friend recommended your book, and I have recently begun working through it.  I have hit the following snag:

In the ToDo Application lesson, when I navigate to http://localhost/todo/items/, I get the following error messages:

Notice (8): Undefined property:  ItemsController::$primaryKey[CORE\cake\libs\controller\scaffold.php, line 160]

Notice (8): Undefined property:  ItemsController::$displayField [CORE\cake\libs\controller\scaffold.php, line 161]

Fatal error: Call to undefined method ItemsController::schema() in C:\Program Files\xampp\htdocs\todo\cake\libs\controller\scaffold.php on line 166

And in fact that is all that shows up on the screen.  If I REM out the var $scaffold; line in the items_controller.php file I just get the error message telling me the index action hasn't been defined in the controller.

I have checked and re-checked my database setup, table name (all lowercase!), made sure the id field was set as the primary key, and of course checked and re-checked my app/models/item.php and app/controllers/items_controller.php files.  I should mention when i navigate to http://localhost/todo/ i get the "happy" welcome page with CSS styles and four green bars at the top telling me everything hooks up.

Is there a clue you can give me by the error messages as to what could be going wrong here?  My first thought was something wrong with the DB given the error from line 160, but like I mentioned I double-checked to make sure the primary key was set to the id field.

Any help would be greatly appreciated!
karlo

Re: Problems with todo Application.

Reply Threaded More More options
Print post
Permalink
I was going through some of the other threads and it dawned on me that I wasn't using my normal text editor to generate the files.  I was wondering if this was possibly putting in extra characters which were messing up the PHP scripts, so I went back to my usual php editor and re-entered everything and presto, everything works.  

Go ahead and delete this thread.
Rajat Kumar

Re: Problems with todo Application.

Reply Threaded More More options
Print post
Permalink
Hey Carlo, this error comes if you have included a variable $name in your controller and have given an invalid name to it.

eg. var $name = "ItemsController"; instead of the correct var $name = "Items"