RE: [SMARTY] Finding first and last section loop var
| From: | Sean Chambers | Date: | Mon, 01 Jul 2002 20:45:08 +0000 |
| Subject: | RE: [SMARTY] Finding first and last section loop var | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-5143@lists.php.net to get a copy of this message | ||
Thank you much sir! Exactly what I was looking for. Keep up the great
work on Smarty!!
-----Original Message-----
From: Monte Ohrt [mailto:monte@ispi.net]
Sent: Monday, July 01, 2002 4:43 PM
To: Sean Chambers
Cc: smarty-general@lists.php.net
Subject: Re: [SMARTY] Finding first and last section loop var
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.