Hello, long time lurker first time poster =)

I am having some issues getting the ball rolling with Zend Framework. We have decided to use our own *_Controller_Action that extends Zend_Controller_Action and in our *_Controller_Action I want to override initView() to instance our own view object that extends Zend_View. Unfortunately there is no way to have Zend_Controller_Action::initView() instance anything other than Zend_View without overriding it in my *_Controller_Action class and duplicating its functionality.

What would be really nice is if Zend_Controller_Action had a protected property for the name of the view class to instance, then in your own controller you could override the default class name:

Example:

abstract class Zend_Controller_Action {
  protected $view_class = 'Zend_View';
  //.....
  public function initView() {
    //.....
    $this->view = new $this->view_class(array('basePath' => $baseDir));
    //.....
  }
}

abstract class Foo_Controller_Action extends Zend_Controller_Action {
  protected $view_class = 'Foo_View';
}

Am I missing the boat here? Is there an easier way to tell the framework to instance a different view using a dynamic basePath by default without having to explicitly do it in each action controller?


Joshua Johnston

Sr. Software Engineer, MailWise, LLC
Main: 617-267-0044
Fax: 617-267-0055
Direct: 617-933-5817
Cellular: 617-697-7521
[EMAIL PROTECTED]



Reply via email to