CakePHP 1.3 - app_controller.php $helpers were not inherited
class AppController extends Controller {
var $helpers = array('Html', 'Form', 'Ajax', 'Javascript');
}
When I try use any helpers above, I get error... because it was 'not loaded' (you understand?!)
But, when I put the same code in any Controller, for example:
class PostsController extends AppController {
var $helpers = array('Html','Ajax', 'Javascript', 'Form');
Works great :)
BUT! What I did wrong in app_controller.php? app_controller not load $helpers? the documentation says it load "everything".
Sorry my English ... I am Brazilian a开发者_如何学Pythonnd I need to use "Google Translate " in some cases =P
Since you are using PHP5, try using "public" instead of var when declaring the helpers array. I think that will correct the inheritance issue.
class AppController extends Controller {
public $helpers = array('Html', 'Form', 'Ajax', 'Javascript');
}
精彩评论