1
votes

I want to create different view scripts for each modules in my application. My structure look like that:

-- application
    -- modules
       -- default
          -- views
             -- default
                -- scripts
             -- fluid
                --scripts

I set default script path in Zend Controller Plugin, which preDispatch() is executed with the request:

$view->setScriptPath(sprintf('%s/modules/%s/views/%s/scripts', APPLICATION_PATH, $module, $views));

Everything works great until i call action from view:

$this->action('activity-stream', 'index', 'observation');

Application throws an exception with message:

script 'index/activity-stream.phtml' not found in path (C:/wamp/www/erp/application/modules/observation/views\scripts/;C:\wamp\www\erp\application/modules/user/views/fluid/scripts/)

Looks like, when calling module with View Action Helper, script path is not set properly. Any idea how to achieve that?

1

1 Answers

0
votes

Problem not solved, but i dit what i want in a different way. Each controller within any module of my application inherits my custom action controller that inherits Zend_Controller_Action. Inside that custom controller i have something like this:

public function init() {
    parent::init();
    $module = $this->_request->getModuleName();
    $config = new Zend_Config_Ini(APPLICATION_PATH . "/configs/modules.ini", $module);
    $layout = isset($config->layout) ? $config->layout : 'default';
    $views = isset($config->views) ? $config->views : 'default';
    $this->view->layout()->setLayout($layout);
    $this->view->setScriptPath(sprintf('%s/modules/%s/views/%s/scripts', APPLICATION_PATH, $module, $views));
}

It's not exactly what i wanted, but solves my problem.