zend-framework, call an action helper from within another action helper

前端 未结 5 1637
耶瑟儿~
耶瑟儿~ 2020-12-31 02:06

i am writing an action helper and i need to call another action helper from within that helper. but i dont know how. here in the sample code:

class Common_Co         


        
相关标签:
5条回答
  • 2020-12-31 02:22

    You can call it in this way:

    $this->_actionController->OtherActionHelper();
    

    The _actionController property references the actual action controller.

    0 讨论(0)
  • 2020-12-31 02:30

    In addition to mercator's answer, add your method after, see example below:

    Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger')->myMethod();
    
    0 讨论(0)
  • 2020-12-31 02:39

    Another solution is:

    $flashMessenger = $this->getActionController()->getHelper('FlashMessenger');
    
    0 讨论(0)
  • 2020-12-31 02:40

    Use the action helper broker:

    $flashMessenger =
        Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');
    
    0 讨论(0)
  • 2020-12-31 02:44

    You can also use getActionController to get a reference back to the actioncontroller you were using for any methods you'd normally use there.

    0 讨论(0)
提交回复
热议问题