Skip to content

Displaying Multiple Templates

Derek Jones edited this page Jul 5, 2012 · 11 revisions

Category:Help::Templates | Category:Help::TipsAndTricks

When you try and load more than one View (for whatever reason) in one function, you see that it simply just won't work. There are a number of ways to do this using cascaded templates or nested templates:

Main template

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
   <title>{title}</title>
   <link href="/css/css.css" rel="STYLESHEET" type="TEXT/CSS" />
</head>

<body>

<div id="logo">
    <img src="logo.gif" alt="logo"/>
</div>

<div id="navside"> {navside} </div>

<div id="cont">
    <div id="intro"> {intro} </div>
    <div id="bread"> {bread} </div>
    <div id="navtop"> {navtop} </div>
    <div id="middle"> {middle} </div>
    <div id="foot"> {foot} </div>
</div>

&lt;/body&gt;
&lt;/html&gt;

Main controller

$maindata['navside'] = $this->parser->parse('navside',$data,true);
$maindata['intro'] = $this->parser->parse('intro',$data,true);
$maindata['bread'] = $this->parser->parse('bread',$data,true);
$maindata['navtop'] = $this->parser->parse('navtop',$data,true);
$maindata['middle'] = $this->parser->parse('cust/view',$data,true);
$maindata['foot'] = $this->parser->parse('foot',$data,true);

$this->parser->parse('main',$maindata);
Clone this wiki locally