Re: [SMARTY] Finding first and last section loop var
| From: | Monte Ohrt | Date: | Mon, 01 Jul 2002 20:43:14 +0000 |
| Subject: | Re: [SMARTY] Finding first and last section loop var | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5141@lists.php.net to get a copy of this message | ||
I'm tempted to put this into the FAQ :-)
{section name=page loop=$pages}
{if $smarty.section.page.first}
... stuff for top of loop ...
{/if}
... normal looped content ...
{if $smarty.section.page.last}
... stuff for bottom of loop ...
{/if}
{/section}
Sean Chambers wrote:
This is what I am trying to do. Fairly simple actually: {section name=page loop=$pages} print some stuff here {/section} All I want to do is insert a certain graphic before the print statement if it is the first loop. The reason for this is because I am displaying graphics with this loop. If it is the first graphic displayed, a graphic needs to be displayed before it. Also I need to know which loop is the final loop so I can again print a special graphic. Thanks for your help. Sean Chambers Web Developer Vann Data Technology Centre Daytona Beach, FL (386) 238-1200 ext. 1205 chamberss@vanndata.com-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.