while in php with smarty
| From: | Elgi | Date: | Mon, 24 Mar 2003 01:28:44 +0000 |
| Subject: | while in php with smarty | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-8856@lists.php.net to get a copy of this message | ||
Hello smarty-general,
I have this in php :
$ind=1;
while ($ind<=$maxp and $ind<=$pmax) {
$pa=$start+$ind;
if ($p==$pa) {
echo (" <font color=\"#FF0000\">".$pa."</font>");
} else {
echo (" <a
href=\"album.php?p=".$pa."\">".$pa."</a>");
}
$ind ++;
}
//$ind<=$pmax for have max x url
I have :
{section name=count loop=$maxp}
{math equation="x + y" x=$start y=$smarty.section.count.iteration assign=pa}
{if $smarty.section.count.iteration<=9}
{if $p==$pa}
<font color="#FF0000">{$pa}</font>
{else}
<a href="album.php?p={$pa}">{$pa}</a>
{/if}
{/if}
{/section}
//$maxp=> total page
//$p=> num of page
//$start=$p or if $p>5, start=$p-5
What do you think ? It's good or not ?
My test it's good but i don't a expert with smarty and php ;))
--
Cordialement,
Elgi