I think you can do the following inside the action helper:
$this->getActionController()->view->varname = 'myvalue';
jasonzfw wrote:
>
> Hi,
>
> In order to consolidate code used throughout each controller, I've created
> an action helper which performs commonplace tasks such as determining
> whether the user is currently logged in, and retrieving the
> application.ini settings for subsequent use within various controller
> actions.
>
> I register this action within the Bootstrap.php file like this:
>
> protected function _initGlobalVars()
> {
> $initializer = Zend_Controller_Action_HelperBroker::addHelper(
> new ZFP_Controller_Action_Helper_Initializer());
> }
>
> Everything works fine, and I can indeed access the variables registered
> within this action helper from any controller action.
>
> However one matter has left me stumped. How can I set some of these
> variables within the view scope? I ask this because for instance logically
> I want to set an appropriate message within the view regarding whether the
> user is logged in. To do so, I currently need to do this within a
> controller's init() method:
>
> public function init()
> {
> if (isset($this->user)) {
> $this->view->user = $this->user;
> }
> }
>
> How can I perform this bit of logic within the action helper, thereby
> altogether eliminating the need to use an init() method for these
> purposes?
>
> Thank you!
> Jason
>
--
View this message in context:
http://old.nabble.com/Registering-view-scope-variables-within-global-action-helper-tp26160459p26160544.html
Sent from the Zend Framework mailing list archive at Nabble.com.