Hello,

We are trying to change the order in which view scripts are searched in the
filesystem and experiencing some difficulties. We generally want to keep all
our View scripts under the same directory like: 

APPLICATION_PATH . '/design/views/modulename/views/scripts/'

and if it is not there, do as always - search for module's default View in
its directory like:

APPLICATION_PATH . '/design/views/modulename/views/scripts/'.

Currently we change the ViewRenderer options in our Bootstrapper like this:

    //Bootstrap.php
    protected function _initView()
    {
        $view = new Zend_View();
        $viewRenderer = new
Zend_Controller_Action_Helper_ViewRenderer($view);
        
        $viewRenderer->setViewBasePathSpec(APPLICATION_PATH .
'/design/views/:module';)
                     ->setViewScriptPathSpec(':controller/:action.:suffix')
                     ->setViewScriptPathNoControllerSpec(':action.:suffix');
                     
        Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
    }
    
Unfortunately we cannot ADD view base path to the stack like this, only set
it. In other words append another base path to existing View object.

Of course there is $view->addBasePath() that adds a path to the stack, but
there we cannot dynamically insert path to module's directory since we don't
have Request object yet.

So having something like:

        $viewRenderer->setViewBasePathSpec();

would be indeed very nice. Or are we missing something? Is there a suggested
approach to such cases?


Thank you.



-----
Dmitry.
-- 
View this message in context: 
http://www.nabble.com/Zend_View%3A-View-scripts-path-stack-and-ViewRenderer-tp23842421p23842421.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to