action.test.php
Code: Select all
<?php
$records = array();
$rec1 = new stdClass();
$rec1->date = '2012-03-24';
array_push($records, $rec1);
$rec2 = new stdClass();
$rec2->date = '2005-02-15';
array_push($records, $rec2);
$rec3 = new stdClass();
$rec3->date = '2000-12-08';
array_push($records, $rec3);
$this->smarty->assign('records',$records);
echo $this->ProcessTemplate('test.tpl');
?>
Code: Select all
<ul>
{foreach from=$records item=entry}
<li>{tester item=$entry->date} - {$entry->date|cms_date_format}</li>
{/foreach}
</ul>
Code: Select all
echo $params['item'];
* 2000-12-08 - Mar 24, 2012
* 2000-12-08 - Feb 15, 2005
* 2000-12-08 - Dec 8, 2000
While the predefined tag is correctly working on each piece of information in the loop, it would seem the user defined tag isn't evaluated until the end and thus each iteration of the loop uses the data from the last loop.