views:

54

answers:

1

Normally it would be in such a structure:

../application/modules/somemodule/views/scripts/index/index.phtml

How I move it to:

../application/templates/somemodule/template1/views/......
../application/templates/somemodule/templateTWOOMG/.......

??

+1  A: 

You need to play with: $viewRenderer::setViewBasePathSpec();

For example in frontController plugin, (or easier, but not so flexible, in Bootstrap.php):

$templateName = 'myTemplate';

$bootstrap = $this->getBootstrap();

$bootstrap->bootstrap('layout');
if ($bootstrap->hasResource('layout')) {
    $layout = $bootstrap->getResource('layout');
    $layout->setLayoutPath($basePath . '/layouts/scripts/');
}

$bootstrap->bootstrap('view');
if ($bootstrap->hasResource('view')) {
    $view = $bootstrap->getResource('view');
} else {
    $view = new Zend_View;
}

$vr = Zend_Controller_Action_HelperBroker::getExistingHelper("viewRenderer");
$vr->setViewBasePathSpec($basePath."/modules/:module/$templateName/views/");

Take a look on getters and setters in frontController, view, layout and viewRenderer classes. There are plenty of methods which allow to customize default directory structure.

takeshin