I use method A and extend the View class to reduce the tedious code.
class Proj_View extends Zend_View
{
protected $tplPage = 'MasterPageTpl'; // Master layout
protected $tplTitle = 'Project View'; // Title set in individual view
protected $tplContent = 'HomeIndexTpl'; // Content template
...
function renderx()
{
$this->content = $this->render($this->tplContent); // Do content
first
return $this->render($this->tplPage); // The the master layout
}
}
Simplistic but functional enough for me.
Ralph Schindler wrote:
>
> Hey group,
> I am curious how everyone implements common headers and footers
> within a given application. As I see it there are two methods:
>
> a) include the header and footer in each view script via the
> $this->render(..) routine.
>
> b) use Zend_Controller Plugins to write to the view a standard header
> and footer to the view body at preDispatch() postDispatch() /
> preRouteStartup / postRouteStartup times.
>
>
--
View this message in context:
http://www.nabble.com/Controller-and-View-Question-tf3462561s16154.html#a9671725
Sent from the Zend Framework mailing list archive at Nabble.com.