Thanks Matthew,
Just saw that I forgot the _helper after I posted. Cheers.
Matthew Weier O'Phinney-3 wrote:
>
> -- Waigani <[EMAIL PROTECTED]> wrote
> (on Tuesday, 18 September 2007, 01:59 PM -0700):
>> Okay I see I have to add
>>
>> $priv = $this->_helper->getHelper('Priv');
>>
>> and then it works.
>
> No, you do not need to do this. As I mentioned in a previous email,
> rename your 'Priv' method to 'direct', and then the following will work:
>
> $this->_helper->priv('hello');
>
>> But why would I not just go
>>
>> $priv = new Hs_Action_Helper_Priv?
>
> Action helpers integrate with the action controllers. Many do not need
> to do so, but if they need to, their constructor receives the current
> action controller, and each time the helper broker is initialized, it is
> set in the action controller itself. The ViewRenderer is an example of
> a helper that has such tight integration.
>
>> What I was hoping for is that action helpers would work like view
>> helpers:
>> register it in the bootstrap and then anywhere in the controller just
>> call
>> the method - ie take out the above step.
>
> They do, but you need to call them from the $_helper property (__call()
> was already in use when action helpers were added to the framework).
>
>
>> Waigani wrote:
>> >
>> > Hi,
>> >
>> > I've written a custom helper:
>> >
>> > class Hs_Action_Helper_Priv extends
>> > Zend_Controller_Action_Helper_Abstract{
>> >
>> > function Priv($priv){
>> > $AclCk = new Hs_Acl_Auth();
>> > return $AclCk->Priv($priv);
>> > }
>> >
>> > }
>> >
>> >
>> > Registered it in the bootstrap:
>> >
>> > Zend_Controller_Action_HelperBroker::addPrefix('Hs_Action_Helper');
>> >
>> >
>> > and called it in an action:
>> >
>> > $this->_helper->priv('hello');
>> >
>> >
>> >
>> > I get the error:
>> >
>> > Cannot redeclare IndexController::indexAction()
>> >
>> >
>> >
>> > Any clues?
>> >
>> > Thanks,
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Action-Helper-tf4477038s16154.html#a12766052
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>
> --
> Matthew Weier O'Phinney
> PHP Developer | [EMAIL PROTECTED]
> Zend - The PHP Company | http://www.zend.com/
>
>
--
View this message in context:
http://www.nabble.com/Action-Helper-tf4477038s16154.html#a12766820
Sent from the Zend Framework mailing list archive at Nabble.com.