user606521
user606521

Reputation: 15474

App::import not working for controller

I need to load controller class and I try:

App::import('Controller','AppController');

or

App::import('Controller','PagesController');

But this every time returns false. When I try this:

App::import('Model','AppModel');

it returns true, so it seems it's not working for controllers - why?

Upvotes: 0

Views: 2965

Answers (1)

ianmjones
ianmjones

Reputation: 3415

When using App::import(type, name) for a controller, you don't need to include "Controller" in the name you import, just when creating the instance variable.

App::import('Controller', 'Pages');
$Pages = new PagesController;

Upvotes: 3

Related Questions