Tuesday, December 1, 2009

Error in the manual?

This page (http://book.cakephp.org/view/53/components-helpers-and-
uses) begins with the following text:
"The next most often used controller attributes tell CakePHP what
helpers, components, and models you'll be using in conjunction with
the current controller. Using these attributes make these MVC classes
available to the controller as a class variable ($this->ModelName, for
example)."

Maybe i'm wrong but i think helpers given by the $helpers attribute
ain't available as class variables ($this->HelperName) as decribed in
the 2nd sentence. At least not in version 1.2.5. So if you want to
access your selt defined 'OwnHelper' i.e. in a controller it's not a
good idea to set

$helpers = array('OwnHelper');

as decribed there but rather have to

App::import('Helper', 'OwnHelper');

it and then assign to the desired class variable:

$this->Own = new OwnHelper;

This doesn't happen automatically. Am i right or am i misunderstanding
something?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en

No comments: