[Solar-talk] View, call helpers after _render() ?

Paul M Jones pmjones at ciaweb.net
Tue Nov 14 14:04:11 PST 2006


Hi Matt --

> I want to be able to wrap a layout around a view. I'm experimenting  
> with doing this in my templates. The page controller is expecting  
> to get the rendered results back and send it to either a single  
> layout template, or print the output.
>
> I want to intercept both of those scenarios and wrap the view with  
> a layout.

You could, in theory, make your main view act as the layout, and the  
make the sub-views into partials (or even separate templates, which  
will run faster).  Here's a quick workup:

<?php
// "in-view" layout
// header code
// ...

// now the "view" portion
include $this->template('layoutContent.php');

// footer code
// ...
?>

The layoutContent.php template can itself use sub-templates and  
partials as well.  Thus, the layoutContent.php template renders  
entirely, and is wrapped by the in-view layout.

Does that help at all?

--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.   <http://solarphp.com>

Savant: The simple, elegant, and powerful solution for
templates in PHP.   <http://phpsavant.com>




More information about the solar-talk mailing list