RE: [SMARTY] Retardation : looping thru photo gallery
| From: | Josh Johnson | Date: | Thu, 24 Oct 2002 19:46:37 +0000 |
| Subject: | RE: [SMARTY] Retardation : looping thru photo gallery | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6233@lists.php.net to get a copy of this message | ||
{if $smarty.section.pics.first}
{$smarty.section.pics.total-1} //<=This gives a number too high by one
{else}
{$smarty.section.pics.index_prev}
{/if}
-----Original Message-----
From: Tim Burden [mailto:tim@psnetworks.net]
Sent: Thursday, October 24, 2002 12:37 PM
To: smarty-general@lists.php.net
Subject: [SMARTY] Retardation : looping thru photo gallery
Ok, I'm a tard.
I want my photo gallery to loop thru a circularly, so the "Previous"
button on the first pic will go to the last pic, and the "Next" button
on the last pic will go to the first pic.
I use $smarty.section.pics.index_prev and
$smarty.section.pics.index_next on most buttons, works good. I use
{if $smarty.section.pics.last}
0
{else}
{$smarty.section.pics.index_next}
{/if}
which works fine for the last pic's "Next" button.
But, when I want to do the first pic's "Previous" button,
{if $smarty.section.pics.first}
{$smarty.section.pics.total} //<=This gives a number too high by one
{else}
{$smarty.section.pics.index_prev}
{/if}
Any suggestions?