|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
stalker Smarty Rookie
Joined: 28 Aug 2003 Posts: 15
|
Posted: Thu Aug 28, 2003 10:23 am Post subject: last index/entry |
|
|
During a loop in a section, how can I find out if I am on the last entry?
I need to apply a special style to the last row and the number or rows is dynamic.
thanks for the feedback
SLK |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Thu Aug 28, 2003 10:58 am Post subject: |
|
|
Perhaps with something like Code: | {foreach from=$blah item=eak name=foo}
{if $smarty.foreach.foo.key == count($blah) - 1}
Last row display it special: <b>{$eak}</b>
{else}
Just a normal row: {$eak}
{/if}
{/foreach} | Let me warn you that was in no way shape or form tested but for all practical reasons should work. I am sure someone will post a better way. _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Aug 28, 2003 1:59 pm Post subject: |
|
|
or even
Code: | ...
{if $smarty.foreach.foo.last}
Last row display it special: <b>{$eak}</b>
{else}
Just a normal row: {$eak}
{/if}
... |
greetings
messju |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|