LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: messju mohr Date: Tue Oct 16 01:09:50 2007 Subject: Re: [SMARTY] Array keys, values
On Tue, Oct 16, 2007 at 09:03:30AM +0200, messju mohr wrote: > On Mon, Oct 15, 2007 at 04:31:23PM -0500, Josh Trutwin wrote: > > > * get the total count of the elements w/o having to iterate through > > > the array > > > > {$my_array|@count} > > > > > * be able to access the first or last element even if the keys > > > aren't numeric > > {$my_array|@reset} and (I forgot) {$my_array|@end} to access the last element. these two expressions just use http://php.net/reset and http://php.net/end as modifiers. > ... just my 2 ct > > > > Not very efficient but could do: > > > > {foreach from=$my_array item=arr name=arr_loop} > > {if $smarty.foreach.arr_loop.first} > > do something for first only > > {/if} > > {/foreach} > > > > Josh > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
| Navigate in group php.smarty.general at sever news.php.net | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by PHP Developer
Powered By PHP Consultants |