Hi,

as I understood the common process of template rendering it works in
this manner:

The MVC component determines (somehow), based on the route, which view
script is supposed to be rendered. This view script will have such a
structure which renders a valid HTML document:

<?php echo $this->render('layouts/__header.phtml'); ?>
<p>some stuff <?= $this->fromView ?> </p>
<?php echo $this->render('layouts/__footer.phtml'); ?>


I'd like to have it vice versa, where the layout is a full HTML document
which renders the related view script. So I managed my application to
work with this "layout" view script:

<html>
<head></head>
<body>
<h1>header stuff</h1>
<?= $this->render( $this->viewScript ) ?></td>
<h1>footer stuff</h1>    
</body>
</html>

In my controller I do this on postDispatch()
public function postDispatch()
{
$this->view->viewScript = $this->getRequest()->getControllerName() 
                        . "/" . $this->getRequest()->getActionName() 
                        . ".phtml";
$this->_helper->viewRenderer->renderScript("layouts/main.phtml" );
}


It works, but it is not flexible cause _forward() renders the layout
view script a second time. Invocation on preDispatch() or smth. else
dont works, cause there are no assigned data available in the view
scripts. Now I believe my approach is a dead-end street...any help is
appreciated ;-)

Best regards
 /Ralf


Reply via email to