0

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.

3 Answers 3

3

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

Sign up to request clarification or add additional context in comments.

2 Comments

how can i change the default route? I want to exicute the IndexController first.
You can change your routes by specifying custom routes inside app/Config/routes.php. Here you can attach the 'homepage' to any controller/action and create custom routes. See this page for more information book.cakephp.org/2.0/en/development/routing.html
1

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'));
    }
}
?>

Comments

0

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

1 Comment

"I just don't know why" — because autoloading is configured that way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.