Frage

Ich habe eine actionHelper mit einer preDispatch Funktion erstellt. Ich mag diese preDispatch einige Daten zu meiner Ansicht nach senden. Jede Idee, wie kann ich das erreichen?

War es hilfreich?

Lösung

Alternatively (from within your action helper):

$view = $this->getActionController()->view;
$view->myKey = 'myValue';

An action helper is one of the few places in a ZF app that has direct access to the controller instance (as opposed to the controller name, which is accessible in lots of ways in various places).

Andere Tipps

hey this would be as easy as this :)

$view = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer')->view; 
$view->your_param  = $your_value ;

then you could access it as usually

$view = Zend_Layout::getMvcInstance()->getView();
$view->yourVar = 'test';
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top