Forums / Setup & design / Process matrix array / Comment26298
Maxime Thomas
Monday 12 May 2008 10:39:30 am
Hi Paul,
I've written the PHP version of the process, in case you were in a custom module/function.By the way, you can adapt to the template version :
{def $results = '<item>'} {foreach ($matrix_data as $index => $row)} {def $case = $index|mod(4)} {switch match=$case} {case match=0} {set $results=$results|append("<title>$row</title>")} {/case} {case match=1} {set $results=$results|append("<location>$row</location>")} {/case} {case match=2} {set $results=$results|append("<fallback>$row</fallback>")} {/case} {case match=3} {set $results=$results|append("<image>$row</image>")} {/case} {/switch} {/foreach} {set $results=$results|append('</item>')} {$results}
Is it clearer ?
Maxime Thomas maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou Company Blog : http://www.wascou.org/eng/Company/Blog Technical Blog : http://share.ez.no/blogs/maxime-thomas