Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

fTemplating - looping through array in template?

posted by anonymous 8 years ago

I am setting some template values thusly:

foreach ($meetingList as $row) {
	$tpl->add('meeting', array(
		"id"            => $row['id'],
		"title"         => $row['title'],
		"description"   => $row['description']
	));
}
$tpl->place('page');

What is the most 'flourishy' way to look through the values, and display them in my template? How Flourish stores these values is beyond my raw php skill, so my attempts at constructing a foreach loop have failed.

I have it working to an extent, but I'm not really happy with the implementation. In my 'page' template, I have something like this:

<?$data = $this->get('meeting');?>

<ol>
<? foreach ($data as $row) {?>
	<li><a href="<?=$this->encode('baseUrl')?>testdrive/meeting<?=$row['id']?>"><?=$row['title']?></a></li>
<?}?>
</ol>

This works, but I would rather prepare the fields in my control file, not the template. Any suggestions on how to accomplish this in a cleaner way?

posted by anonymous 8 years ago