Reputation: 1
I am very new to cakephp.
I have my project registration in the workspace. I have created an IndexController
, which contains method index()
.
When I run my project by using workspace/registration/ it displays the following error:
Error: WorkspaceController could not be found. Create the class WorkspaceController below in file: app/Controller/WorkspaceController.php.
Please help me to solve this.
Upvotes: 0
Views: 5016
Reputation: 1
You have to use filename as IndexController.php
instead of index_controller.php
or anything else. I just don't know why, but it works fine in my case and your class name also should be IndexController
Upvotes: 0
Reputation: 1131
I was getting the same message. Problem was that code was not wrapped inside <?php ... ?>
. So basically code should look like:
<?php
class PostsController extends AppController {
public $helpers = array('Html', 'Form');
public function index() {
$this->set('posts', $this->Post->find('all'));
}
}
?>
Upvotes: 1
Reputation: 29137
I think the error-message says it all;
Create the class WorkspaceController below in file:
app/Controller/WorkspaceController.php
Basically, using the default routes, urls use this schema:
http://mysite.com/mycontroller/myaction/param1/param2/param...
Will be routed to:
MycontrollerController::myaction($param1, $param2);
So with your url, CakePHP is trying to execute:
WorkspaceController::registration()
Which apparently doesn't exist
Upvotes: 3