Hi Ralf,

>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:

The MVC component utilises an optional (enabled by default) plugin called 
Zend_Controller_Action_Helper_ViewRenderer which insitutes a convention of 
mapping Module/Controller/Action names to a relevent view script name. So 
IndexController::saveAction() will automatically render the view script at
{viewBasePath}/index/save.phtml.

You can modify the convention by altering a few settings on the ViewRenderer 
(covered at least once in the past day on the mailing lists ;)). Or even 
disable the automated rendering if you prefer.

>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:

Indeed, there have been proposals for achieving this hanging around from months 
addressing the concept of common "Layouts". This was captured in two proposals 
- Zend_View Enhanced and Zend_Layout. The Zend_Layout methodology has been 
decided to be used in ZF 1.1 so I can point you to the soon-to-be-official 
approach offered by Ralph Schindler.

Unfortunately the ZF Wiki cannot be referred to since it is perfectly useless 
to anyone in GMT and is presently offline as usual. But there's a good blog 
post containing all the details and a brief tutorial of usage:
http://www.spotsec.com/blogs/archive/the-basics-of-zend_layout-ahem-xend_layout.html

In combination with Zend_Layout, pretty much all of the remaining Zend_View 
Enhanced (excepting its Layout solution) is also to be implemented in ZF 1.1. 
This adds concepts such as Partials, Components (controller calls), 
Placeholders (capture data from view scripts for inclusion in a Layout/Other 
View), and some other stuff.

In combination, both ZL and ZVE should be sufficient to resolve most of the 
problems people currently have with Zend_View.

Regards,
Paddy

 
Pádraic Brady

http://blog.astrumfutura.com
http://www.patternsforphp.com
OpenID Europe Foundation Member-Subscriber


----- Original Message ----
From: Ralf Kramer <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, September 20, 2007 12:30:46 AM
Subject: [fw-general] Using a complete HTML Template

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









      
____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 

Reply via email to