Learning CakePHP

April 1, 2009

Tips and Tricks: Allowing Global Definition of Components and Helpers in CakePHP

:D

I am starting to create my layouts and pages. But I encountered this problem (much to my annoyance. How much errors could I take?):

Notice (8): Undefined variable: javascript [APP/views/layouts/default.ctp, line 14]

I remembered encountering this before on my localhost development. So I browsed my local files and see that I created an app_controller.php inside app/controllers/

The controller just have these codes:

<?php

class AppController extends Controller {

  var $helpers = array(‘Html’, ‘Form’, ‘Ajax’, ‘Javascript’, ‘Time”);

  var $components = array(‘Session’); 

  }

?>

which just enables you to allow the use of the following helpers and components all throughout your cakePHP application without redefining these on individual controllers.

so. ciao! :D n

Advertisement

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.