Re: Printing selective elements of an array

From: Date: Tue, 22 Jan 2002 14:51:13 +0000
Subject: Re: Printing selective elements of an array
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2561@lists.php.net to get a copy of this message
On 22/1/02 2:28 pm, "Andrei Zmievski" <andrei@ispi.net> wrote: > On Mon, 21 Jan 2002, Neil Galvin wrote: >> My non-working smarty code is: >> >> {section name=list loop=$search_artist} >> >> {if $search_artist[list].artist_name == $search_artist[list-1].artist_name} >> {* >> I have tried using index & index_prev to no avail. >> I have also tried creating an array and offseting it by one to use instead >> of [list] > > How did you try to use index_prev? > > -Andrei > > "Claiming Java is easier than C++ is like > saying that K2 is shorter than Everest." > -- Larry O'Brien (editor, Software Development) > Hi Andrei. I have tried comparing index to index_prev {section name=list loop=$search_artist} {if $search_artist[index].artist_name == $search_artist[index_prev].artist_name} <a href="/product/catalogue_no/{$search_artist[index].catalogue_no}">{$search_ artist[index].product_title}</A><BR> {else} <BR><BR><B> {$search_artist[index].artist_name}</B><BR> <a href="/product/catalogue_no/$search_artist[index].catalogue_no">{$search_art ist[index].product_title}</A><BR> {/if} {/section} And section name list to index_prev {section name=list loop=$search_artist} {if $search_artist[list].artist_name == $search_artist[index_prev].artist_name} {* I have tried using index & index_prev to no avail. I have also tried creating an array and offseting it by one to use instead of [list] *} <a href="/product/catalogue_no/{$search_artist[list].catalogue_no}">{$search_ artist[list].product_title}</A><BR> {else} <BR><BR><B> {$search_artist[list].artist_name}</B><BR> <a href="/product/catalogue_no/$search_artist[list].catalogue_no">{$search_arti st[list].product_title}</A><BR> {/if} {/section} Regards Neil

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