RE: [SMARTY] Looping through a four-dimensional array

From: Date: Tue, 15 Oct 2002 21:32:22 +0000
Subject: RE: [SMARTY] Looping through a four-dimensional array
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6167@lists.php.net to get a copy of this message
Pssst... that would be a great candidate for defining a class! Smarty loves OOP :) Just on an OOP trip from extending the smarty class, I decided to use mysql_fetch_object in all of my database fetching functions, and avoided all of the problems people have had with multidimensional arrays (and I have some pretty complex data structures because of lots of JOINs in my SQL), totally by coincidence! In your case, you could just have a flat array of objects... :) Btw, Your secret is safe with me! :) -- Josh -----Original Message----- From: Johannes Schill [mailto:johannes.schill@polyester.se] Sent: Tuesday, October 15, 2002 10:37 AM To: smarty-general@lists.php.net Subject: Re: [SMARTY] Looping through a four-dimensional array Well.. 1st [] = Vertical position 2nd [] = Horizontal position (left/right) 3rd [] = Data row 4th [] = The data type. (string) url/text/id Don't tell anyone. :-) ----- Original Message ----- From: "Josh Johnson" <mailing_lists@allusiveimage.com> To: "'Johannes Schill'" <johannes.schill@polyester.se>; <smarty-general@lists.php.net> Sent: Tuesday, October 15, 2002 4:28 PM Subject: RE: [SMARTY] Looping through a four-dimensional array > I'm still curious to know why you're using a 4-dimensional array? :) > > -- Josh > > -----Original Message----- > From: Johannes Schill [mailto:johannes.schill@polyester.se] > Sent: Tuesday, October 15, 2002 10:24 AM > To: smarty-general@lists.php.net > Subject: Re: [SMARTY] Looping through a four-dimensional array > > This is how i solved it (in the template): > > {assign var="tmp" value=$goldTexts[gd_Id][0]} > {section name=gTxt loop=$tmp} > {$tmp[gTxt].text} > {/section} > > I had to break down the array (see row one). > > Works fine now. Thanks. > > Best regards, > Johannes Schill > > > > ----- Original Message ----- > From: "Johannes Schill" <johannes.schill@polyester.se> > To: <smarty-general@lists.php.net> > Sent: Tuesday, October 15, 2002 4:05 PM > Subject: [SMARTY] Looping through a four-dimensional array > > > > Hello, > > > > Anyone who've managed to loop through a four-dimensional array using > > section? > > > > This is an example of how my array looks like: > > $goldTexts[0][0][0][url] > > > > This is where i assign it: > > $smarty->assign("goldTexts", $goldTexts) > > > > And this is my section-tag(s): > > {section name=gTxt loop=$goldTexts} > > {$goldTexts[gd_Id][0][gTxt].url} > > {/section} > > > > The problem is: it doesnt loop through the whole array, only the first > > value. > > > > Any suggestions? I'll let you know if I manage to solve it though. > > > > Best regards, > > Johannes Schill > > > > > > -- > > Smarty General Mailing List (http://smarty.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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