For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > April 2005 > Iterations









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Iterations
Reynier Perez Mira

2005-04-11, 4:02 pm

I using SmartyPaginate plugin to paginate result obtains from a query. The questions is I need to know the iteration number depending of page I stay. Take a look to this code:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="tdright">{$paginate.first} - {$paginate.last} {$paginate.total}</td>
</tr>
</table>
{section name="guestbook_data" loop=$arrUsName}
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table">
<tr>
<td colspan="8" class="th">Mostrando firma {$smarty.section.guestbook_data.iteration}</td>
</tr>
<tr>
<td width="79%" class="padding-td">Firmado por: {$arrUsName[guestbook_data]}</td>
<td width="3%" class="image">
{if $arrUsEmail[guestbook_data] neq ""}
<img src="themes/images/contacticon.gif" alt="{$arrUsEmail[guestbook_data]}">
{/if}
</td>
<td width="3%" class="image">
{if $arrUsCountry[guestbook_data] neq ""}
<img src="themes/images/users/world.gif" alt="{$arrUsCountry[guestbook_data]}">
{/if}
</td>
<td width="3%" class="image">
{if $arrUsWebSite[guestbook_data] neq ""}
<a href="{$arrUsWebSite[guestbook_data]}" target="_blank"><img src="themes/images/users/website.gif" border="0" alt="{$arrUsWebSite[guestbook_data]}"></a>
{/if}
</td>
<td width="3%" class="image">
{if $arrUsYim[guestbook_data] neq ""}
<img src="themes/images/users/yim.gif" alt="{$arrUsYim[guestbook_data]}">
{/if}
</td>
<td width="3%" class="image">
{if $arrUsMsn[guestbook_data] neq ""}
<img src="themes/images/users/msn.gif" alt="{$arrUsMsn[guestbook_data]}">
{/if}
</td>
<td width="3%" class="image">
{if $arrUsIcq[guestbook_data] neq ""}
<img src="themes/images/users/icq.gif" alt="{$arrUsIcq[guestbook_data]}">
{/if}
</td>
<td width="3%" class="image">
{if $arrUsAim[guestbook_data] neq ""}
<img src="themes/images/users/aim.gif" alt="{$arrUsAim[guestbook_data]}">
{/if}
</td>
</tr>
<tr>
<td colspan="8" valign="top" class="padding-td"><strong>Comentarios:</strong> {$arrUsComments[guestbook_data]|nl2br}</td>
</tr>
</table><br>
{/section}
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="tdright">{paginate_prev} {paginate_middle} {paginate_next}</td>
</tr>
</table>

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

When I stay in first page in wich $next var have 0 or 1 value all is ok, {$smarty.section.guestbook_data.iteration } show me 10 values but when I move to another page and $next var take another value like 2 for example {$smarty.section.guestbook_data.iteration } show me tha same values when I want to begin in 11 and show even 20?

How I can solve this?

Reynier Pérez Mira

3ero. Ing. Informática

Entre más inteligente me siento, más me doy cuenta de lo ignorante que soy.




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com