sections

From: Date: Sat, 13 Dec 2003 13:10:16 +0000
Subject: sections
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10684@lists.php.net to get a copy of this message
hi I made a section to loop some news, but i want the date as header and if the second news has the same date it should not be displayed twice. I made it like this: <table> {assign var="lastdate" value="0"} {section name=Index loop=$news} {if $news[Index].date ne $lastdate} <TR><td>{$news[Index].date}</td></tr> {/if} <tr><Td>{$news[Index].headline}</td></tr> {assign var="lastdate" value=$news[Index].date} {/section} </table> But like this I must use a second var. My question now is, is there a way to do the same without using a second var. somthing like: {if $news[Index].date ne $news[Index-1].date]} but this does not work. It would be nice if someone tells me, because i am really a smarty newbe. Thanks Franco

« previous php.smarty.general (#10684) next »