Re: Foreach - get the line number
| From: | Luc Saint-Elie | Date: | Wed, 02 Jul 2003 14:58:10 +0000 |
| Subject: | Re: Foreach - get the line number | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9809@lists.php.net to get a copy of this message | ||
Olivier,
I don't know if this is possible with foreach but this is with section :
http://smarty.incutio.com/?page=SmartyFrequentlyAskedQuestions#template-9
Luc
Olivier Doucet [reagi.com] a écrit:
I'm using foreach to go throuh a big array. But i want to show the number of the line. {foreach from=$lesfiches item=fiche} $i - <a href="ct_faq.php?id={$fiche.id}">{$fiche.titre}</a><br> {/foreach} Replace $i by the number of the line, ie : 1- <a href="ct_faq.php?id=51">Title</a><br> 2- <a href="ct_faq.php?id=31">Title</a><br> 3- <a href="ct_faq.php?id=47">Title</a><br> I haven't seen how to do this in the doc. Can u help me ?=========================================
Luc Saint-Elie - Journaliste
7, rue Androuet 75018 Paris
------------------------------------------
telephone: 01 42 57 20 28 / 06 12 90 19 65
email : luc@saint-elie.comWeb : http://luc.saint-elie.com =========================================