Archive

Archive for the ‘CakePHP’ Category

Undefined variable: javascript in CakePHP

April 17th, 2011 No comments

I was trying to make CakePHP dynamically add javascript and css files, but I kept getting the error Undefined variable: javascript. I was sure that I had added the Javascript helper in the app_controller. After some results on google I found out that if you misspell a helper name then CakePHP will throw this error. It has nothing to do with the object $javascript not being defined.

So I changed: 

var $helpers = array('Form', 'Html', 'Javascript', 'Time','Sessions');

to 

var $helpers = array('Form', 'Html', 'Javascript', 'Time','Session');

Session is not in plural…

Categories: CakePHP, PHP Tags: