Re: [SMARTY] Array keys, values

From: Date: Tue, 16 Oct 2007 07:03:30 +0000
Subject: Re: [SMARTY] Array keys, values
References: 1 2 3 4  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-13782@lists.php.net to get a copy of this message
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} ... 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

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