For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > April 2005 > Re: [SMARTY] order arrays









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [SMARTY] order arrays
Messju Mohr

2005-04-18, 8:58 am

On Mon, Apr 18, 2005 at 02:02:13AM +0200, Roderik Emmerink wrote:
> Hi,
>
> I've got the code:
>
> {foreach item=premiumvermelding_id from=$premiumvermeldingen}
> <htmltags>
> {insert_object id=$premiumvermelding_id}</htmltags>
> {/foreach}
>
> to iterate an array.
> I'd like to randomize the order in which the assigned array is iterated.
> Is this possible with smarty?


write a modifier that shuffles the array. and use it like

{foreach item=premiumvermelding_id from=$premiumvermeldingen|@shuffle}
....

HTH
messju
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com