syedasimmeesaq
asked on
why this simple cakephp app not working
I am trying out cakephp and I have database configured. I have three tables in database,
posts
users
comments
In models folder I have 2 files, post.php and user.php
post.php has this
<?php
class Post extends AppModel {
var $name='Post';
var $blenogsTo = array('User');
}
?>
user.php has this
<?php
class User extends AppModel {
var $name = 'User';
var $hasMany = array('Post');
}
?>
then under controllers folder I have 2 files, posts_controller.php and users_controller.php
in posts_controller.php I have this
<?php
class PostsController extends AppController {
var $name = 'Posts';
var $scoffold;
}
?>
in users_controller.php I have this
<?php
class UsersController extends AppController {
var $name = 'Users';
var $scoffold;
}
?>
Now all I am doing is scoffolding and when I go to localhost/cake/users
it gives me this error
Missing Method in UsersController
Error: The action index is not defined in controller UsersController
Error: Create UsersController::index() in file: app\controllers\users_cont roller.php .
<?php
class UsersController extends AppController {
var $name = 'Users';
function index() {
}
}
?>
Notice: If you want to customize this error message, create app\views\errors\missing_a ction.ctp.
any help will be appreciated.
Thanks
posts
users
comments
In models folder I have 2 files, post.php and user.php
post.php has this
<?php
class Post extends AppModel {
var $name='Post';
var $blenogsTo = array('User');
}
?>
user.php has this
<?php
class User extends AppModel {
var $name = 'User';
var $hasMany = array('Post');
}
?>
then under controllers folder I have 2 files, posts_controller.php and users_controller.php
in posts_controller.php I have this
<?php
class PostsController extends AppController {
var $name = 'Posts';
var $scoffold;
}
?>
in users_controller.php I have this
<?php
class UsersController extends AppController {
var $name = 'Users';
var $scoffold;
}
?>
Now all I am doing is scoffolding and when I go to localhost/cake/users
it gives me this error
Missing Method in UsersController
Error: The action index is not defined in controller UsersController
Error: Create UsersController::index() in file: app\controllers\users_cont
<?php
class UsersController extends AppController {
var $name = 'Users';
function index() {
}
}
?>
Notice: If you want to customize this error message, create app\views\errors\missing_a
any help will be appreciated.
Thanks
ASKER
which file?
what do u mean $uses?
thanks
what do u mean $uses?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Make sure this is in your controller: $uses = array('User');