Hey :).

I'm using a modulas structure:

htdocs/
modules/
    articles/
        views/
            scripts/
    pages/
        views/
            scripts/
    default/
        views/
            scripts/
                templates/
                    default.phtml

So I have this implementation, I'm using a Plugin, called TemplatePlugin, to 
inject the current action view into a template, like this:

class TemplatesPlugin extends Zend_Controller_Plugin_Abstract
{
    public function dispatchLoopShutdown()
    {
        // Get front-controller.
        $objFrontController = Zend_Controller_Front::getInstance();

        // Get request.
        $objRequest = $objFrontController->getRequest();

        // Get response.
        $objResponse = $objFrontController->getResponse();

        // Get current view.
        $objView = Zend_Controller_Action_HelperBroker::getExistingHelper( 
'viewRenderer' )->view;

        // Get current action view 'body' and then inject it into a Zend_View 
attribute, this string will be displayed into "templates/default.phtml".
        $objView->tplBody = $objResponse->getBody();

        // Render view using a template.
        switch ( $objRequest->getModuleName() )
        {
            default:
                // Set body into the this template.
                $objResponse->setBody( $objView->render( 
"templates/default.phtml" );
        }
    }
}

So this is the issue, seems like when I'm render another action from another 
module, like articles, this file "templates/default.phtml" is not used, I mean, 
seems like per module the render() method try to look into the "views/scripts/" 
folder, so my "template" doesn't work for another template, I try to use an 
absolute path for the template, like 
"/home/jfalvarez/public_html/site/modules/default/views/scripts/templates/default.phtml"
 but doesn't work :S

Any ideas ?

Thx.

Reply via email to