Thursday, September 8, 2011

Cake 2.0: Creating an helper accessible in layouts

How do I create an helper accessible in layouts?

I created a file 'Fasset.php' in App/View/Helper that looks like:

App::uses('AppHelper', 'View/Helper'); // Do I need it? Not sure what
App::uses does. I found it in FormHelper
App::import('Core', array('Sanitize'));

class FassetsHelper extends AppHelper {

}

And In the App/Controller/AppController.php

I have :
App::uses('Controller', 'Controller');

class AppController extends Controller {
public $helpers = array('Fassets'); //If I actually add 'Html' in
the array even $html give me an error.
}

In the layout.cpt the $fassets does not exist.

What do I do wrong?
Do you have some documentation on helper in Cake 2.0?

I saw that even the constructor of the helper is different (i.e. The
first parameter is a View).

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: