I'm using the template parser class in codeigniter to display database results in a view file. Is it possible to parse an array like this:
foreach($query->result() as $news){
$articles[$news->id] = array(
'ID' => $news->id,
'TITLE' => $news->title,
'BODY' => $news->body
);
}
$data = array(
'NEWS_ARTICLES' => array(
$artcicles
);
$this->parser->parse('index.tpl', $data);
<div id='news'>
<h1>Recent News</h1.
{NEWS_ARTICLES}
<div class='article'>
<h1>{TITLE}</h1>
<p>{BODY</p>
</div>
{/NEWS_ARTICLES}
</div>