Muhammad Ali Hassan
Muhammad Ali Hassan

Reputation: 962

cakephp controller not working; view page not found

i installed fresh cakephp. its app controller working fine. but when i write my controller and its view but this result in page not found. My code is given below

class PostsController extends Controller {
    public $helpers = array('Html', 'Form');
    public function index() {
        $this->set('posts', $this->Post->find('all'));
    }
}

and create folder named Posts in view folder and over there create index.ctp file as well. but its result in page not found. Please help what may be mistake by me or is there any need to configuration. Thanks

Upvotes: 0

Views: 1679

Answers (2)

Fazal Rasel
Fazal Rasel

Reputation: 4526

there might problem apache rewrite module. if you are using WAMP, just put on your rewrite module.

Upvotes: 0

theotherdy
theotherdy

Reputation: 715

Your controller should be named PostsController.php (ie plural)

Just spotted it, you need to extend AppController in CakePHP 2.x, not Controller: ie:

class PostsController extends AppController {

Upvotes: 3

Related Questions