Re: [SMARTY] Array help.

From: Date: Fri, 22 Nov 2002 14:29:23 +0000
Subject: Re: [SMARTY] Array help.
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6508@lists.php.net to get a copy of this message
You would be better off passing the data to Smarty the way it expects it, then use html_options: $opt_array = array ( 17 => 'East Fife', 162 => 'Montrose FC', 23 => 'Queens Park' ) {html_options options=$opt_array} Or, do them separately: $opt_vals = array(17,162,23); $opt_out = array('East Fife','Montrose FC','Queens Park'); {html_options values=$opt_vals output=$opt_out} Monte On Fri, 2002-11-22 at 06:33, John Wards wrote: > Hi, > > I am having bother with an array anyone got anyideas? > > Here is what I want to do: > > I have two arrays with the structure: > > {$club_array} > 17 => East Fife > 162 => Montrose FC > 23 => Queens Park > > {$opposition_nav_array} > 0 => 17 > 1 => 162 > 2 => 23 > > I want to run a section like this: > > {section name=nav loop=$opposition_nav_array} > <option value="/main/s{$opposition_nav_array[nav]}.php"> > {$club_array[$opposition_nav_array[nav]]} > </option> > {/section} > > This bit is causing me the problem: > {$club_array[$opposition_nav_array[nav]]} > > $club_array has keys which equal the values of $opposition_nav_array and the > above doesn't work. > > Any clues? > > Cheers > John Wards -- Monte Ohrt <monte@ispi.net>

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