You see, we're inside two foreach loops here:
Code: Select all
{foreach from=$entries item="dategroup"}
{foreach name="entryloop" from=$dategroup.entries item="entry"}
{if $smarty.foreach.entryloop.first}
First News!
{/if}
{/foreach}
{/foreach}
So, we're looking at a data structure that's grouped into... well... groups:
Code: Select all
date1
entry1
date2
entry2
entry3
date3
entry4
entry5
In this example, we go through the outside loop three times: once for each date. We go through the inside loop once per entry. So for entries 1, 2, and 4, the inside loop is on its first iteration (exactly what you're seeing).
You could look for the .first on the outside loop, but then everything in the first date-group would get highlighted. (So if entry1 and entry2 were in date1, both would get the big icons.)
To get only the first entry, you need this:
Code: Select all
{foreach name="dateloop" from=$entries item="dategroup"}
{foreach name="entryloop" from=$dategroup.entries item="entry"}
{if $smarty.foreach.dateloop.first and $smarty.foreach.entryloop.first}
First News!
{/if}
{/foreach}
{/foreach}
However, this will fail if you have sticky entries, since they always fall in the first dategroup, and you probably want the first actual NEWS item highlighted.
To get the *really* first entry, skipping stickies, I think you need this:
Code: Select all
{counter start=1}
{foreach from=$entries item="dategroup"}
{foreach from=$dategroup.entries item="entry"}
{if not $dategroup.is_sticky}
{counter print=false assign='entrycount'}
{/if}
{if $entrycount == 1}
First News!
{/if}
{/foreach}
{/foreach}
You could do stuff with {assign}, too, of course, but then your {if} gets really big. {counter} is pretty fast, and maybe you'll figure out something else to do with the entry count. (I like assigning multiple classes, one of which has the variable value in it, myself: <img src="whatever" class="newsicon newsicon{$entrycount}"/> provides tags for styling every icon, the first icon, and any later icons.)