Hi

Thanks for your two responses both make sense, and the session one works fine.

Cheers

Ian


Gavin Vess wrote:
Hi Ian,

If your application has only one view object, then using the registry is ok, but all controllers will write to the same view object, possibly polluting it or causing name clashes. If your application never uses more than a single controller, then pollution and name collision won't occur within this view object accessed via the registry.

However, if your application uses multiple view objects, using the setParam() approach works nicely, to keep the different view objects separated. The ZFDemo tutorial uses the setParam() approach.

Cheers,
Gavin

Ian Warner wrote:
HI

What is the preferred method for having global data:

ie in Boot

$controller->setParam('view', $view);

Zend_Registry::set('view', $view);

in Controller

  /**
   *
   */
  protected $_view = null;

  // }}}
  // {{{ __init()

  public function init()
  {
// Maps to arg 'view' from: $frontController->setParam('view', $view);
      $this->_view = $this->getInvokeArg('view');
  }

  // }}}

or

      // Add items required from the registry
      $view = Zend_Registry::get('view');

chec

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to