thats right. Simply tell the viewRenderer that you want to use another view.
You actually do not even need to subclass it, I'd assume Leo has some own
functionality in there.

After doing what he wrote, you also need to register the viewRenderer in the
helperBroker to use it.

2007/8/31, Leo Büttiker <[EMAIL PROTECTED]>:
>
> Hi Joshua,
> There's a way! The hole Zend MVC is sometimes a bit hard to understand (I
> had a pretty hard time to get into it).
>
> I think you can do in you bootstrap like this:
>         $view = new Trevi_View();
>         $viewRenderer = new Trevi_Controller_Helper_ViewRenderer();
>         $viewRenderer->setViewBasePathSpec(dirname)
>
> ->setViewScriptPathSpec('/:module/:controller/:action.:suffix')
>                  ->setView($view);
> So it still instance Zend_View and you replace it. But I think you can
> leave
> with that (at least we can).
> Cheers,
> Leo
>
> P.S.: Use fw-mvc for MVC related questions (at least I read more carfull
> there).
>
>
> -----Ursprüngliche Nachricht-----
> Von: Joshua Johnston [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 30. August 2007 21:08
> An: [email protected]
> Cc: Mitch Penrod
> Betreff: [fw-general] Subclassing Zend_View and instancing in initView();
>
> 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