How can I print an $array[index] in a section?

From: Date: Sun, 07 Apr 2002 17:50:12 +0000
Subject: How can I print an $array[index] in a section?
References: 1 2 3 4  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3540@lists.php.net to get a copy of this message
Hi dwerg, think, you are mixing up things. The "index" feature just returns the current index of the loop, so if you had something like for($i=0;$i<10;$i++) {dosomething();} then the value of $i would be the same as the index of the loop. In fact that´s the reason, why often $i is used as an *index* in such statements. I was talking about the index of an array. So if you got $a = array( 'blue'=> 'sky', 'fly'=> 'high' ); you can access the values 'sky' and 'high' via $a['blue'] and $a['fly'], what would be their keys. But besides that you can access them via their indices: $a[0] and $a[1]. > You can access the idices; > > http://www.phpinsider.com/php/code/Smarty/docs/language.function.section.html > {section name=customer loop=$custid} > {$smarty.section.customer.index} id: {$custid[customer]}<br> > {/section} Have a nice day, Jones

« previous php.smarty.general (#3540) next »