> > 
> > What is the best way to achieve this?
> 
> In your bootstrap or an early-running plugin (routeStartup(), 
> routeShutdown(), dispatchLoopStartup()), either create your 
> own view object and feed it into the ViewRenderer, or pull 
> the view object from the ViewRenderer and set a base path:
> 
>     // first option:
>     $view = new Zend_View(array('basePath' => 'path/to/base/views'));
>     
> Zend_Controller_Action_HelperBroker::getStaticHelper('viewRend
> erer')->setView($view);
> 
>     // second option:
>     $viewRenderer = 
> Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
>     $viewRenderer->initView();
>     $viewRenderer->view->setBasePath('path/to/base/views');
> 

Wonderfull. Thanks, I should've explore the Zend_View API.

I used to create a zend_view object in the bootstrap and store it into the
registry

        $view = new Zend_View();
        $view->setScriptPath('/path/to/script');
        $view->setHelperPath('/path/to/helper');
        Zend_Registry::getInstance()->set('view', $view);

While the IndexController 

        Public function indexAction() {
          $this->initView();
            $this->view->title = 'bla';
            $this->render();
        }

The view/scripts/index/index.html was doing

        <?php
Zend_Registry::get('view')->render('path/to/base/view/layouts/header.phtml')
; ?>

      <?php echo $this->title; ?>

        ..etc

Now 

        <?php $this->render('path/to/base/view/layouts/header.phtml'); ?>

      <?php echo $this->title; ?>

        ..etc

Regards,
Michael


--- 


Reply via email to