Patrick Maciel
Patrick Maciel

Reputation: 4944

CakePHP 1.3 - app_controller.php $helpers were not inherited


CakePHP: 1.3
OS: Ubuntu 10.10
Apache: 2.2
PHP: 5.3+
MySQL: 5.1

I have the /app/app_controller.php

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 and I need to use "Google Translate " in some cases =P

Upvotes: 0

Views: 962

Answers (1)

Scott Harwell
Scott Harwell

Reputation: 7465

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

Upvotes: 1

Related Questions