Re: [SMARTY] Access to multidimensional array in smarty template

From: Date: Tue, 04 Nov 2003 12:40:07 +0000
Subject: Re: [SMARTY] Access to multidimensional array in smarty template
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10499@lists.php.net to get a copy of this message
On Tue, Nov 04, 2003 at 12:34:11PM +0100, Ji?í N?mec wrote: > Hello, > > is there some solution how to solve this problem? - there are selected > data from db table and there is a multidimensional array. How can I > acces to value in multi-array via index from db selected data. > > Eg: > > this is an array with signs: > > $signs = array(); > $signs[1]['cz'] = 'Beran'; > $signs[1]['en'] = 'Aries'; > $signs[2]['cz'] = 'Býk'; > $signs[2]['en'] = 'Taurus'; > $signs[3]['cz'] = 'Blí?enci'; > $signs[3]['en'] = 'Gemini'; > $signs[4]['cz'] = 'Rak'; > ....etc > > i have to do somethink like it: > > $signs.($people[0].sign).($smarty.session.sessdata.lang) > ^ array ^ sign from db ^ language from session > > but this evidently won't work. have somebody some idea how to solve > this problem? you can't do this in one rush, unfortunately. you have to: {assign var=people_sign value=$people[0].sign} {assign var=lang value=$smarty.session.sessdata.lang} {$signs.$people_sign.$lang} HTH messju > Ji?í N?mec, ICQ: 114651500 > www.menea.cz - www stránky a aplikace > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

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