The best place to look for advice would be the core code itself. In
libs/controller/controller.php, at the end of the paginate() function,
it ensures that the paginator helper will be loaded with this code:
if (!in_array('Paginator', $this->helpers) && !array_key_exists
('Paginator', $this->helpers)) {
$this->helpers[] = 'Paginator';
}
If that seems long-winded, add a method to AppController:
function useHelper($helper) {
$helpers = func_get_args();
foreach($helpers as $helper) {
if (!in_array($helper, $this->helpers) && !array_key_exists
($helper, $this->helpers)) {
$this->helpers[] = $helper;
}
}
}
Then in your action you can do
$this->useHelper('Textile', 'Javascript');
hth
grigri
On Dec 16, 1:31 pm, Rob Wilkerson <[email protected]> wrote:
> How should I add multiple action-specific helpers? Originally I had:
>
> $this->helpers[] = 'Textile';
>
> When I wanted to include the Javascript helper for this action, I
> couldn't find the "right" syntax (if there is a right syntax) to do
> so. I want to retain the default helpers, too. I've made it work
> using traditional PHP array syntax, but am wondering if that's going
> to cause me any problems down the line. For now, at least, I have:
>
> array_push ( $this->helpers, 'Textile' );
> array_push ( $this->helpers, 'Javascript' );
>
> Total noob question, I know, but I _am_ a noob so it probably won't be
> the last time while I get a grip on what's possible and the best
> practices. :-)
>
> Thanks.
>
> Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---