-- Michael Raymond <[EMAIL PROTECTED]> wrote
(on Thursday, 20 September 2007, 12:44 PM +0700):
> In developing app which using the conventional modules design
> 
> Application/
>   configs/
>   modules/
>     default/
>       controllers/
>       views/
>     blog/
>       controllers/
>       views/
> 
> 
> Each modules has directories for controllers and views. I want to have a
> base view directory to store the view files which will be use in every
> modules (say, common layout files like html header and footer). I've consult
> the programmer's reference/manual of the Zend_Controller but couldn't find
> any info about it, but I might have miss it. 
> 
> 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('viewRenderer')->setView($view);

    // second option:
    $viewRenderer = 
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
    $viewRenderer->initView();
    $viewRenderer->view->setBasePath('path/to/base/views');

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to