Monday, November 3, 2008

Undefined variable: javascript (..default.ctp)

This error was causing me fits as it was not really throwing an error on the screen, only in my debug.log. What I found was that this was coming from not having my reference in the right controller. Each of my controllers had a similar reference:

class FaqsController extends AppController {
var $name = 'Faqs';
var $helpers = array('Html', 'Form', 'Javascript', 'Fck');
....
}

The error I was seeing was being generated by my default layout. All I had to do to fix this was put the following in my app_controller.php file.

class AppController extends Controller {
var $helpers = array('Html', 'Javascript');
}

Thanks to the V-TEK Channel blog and this link for pointing me in the right direction.

0 comments:

Post a Comment