Re: complex array and smarty

From: Date: Mon, 09 Aug 2004 14:35:30 +0000
Subject: Re: complex array and smarty
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-193199@lists.php.net to get a copy of this message
From: "adwinwijaya" <adwinwijaya@yahoo.com.au> > Assume I have array that looks like : > > Array( > 'type'->'Fiction', > 'notes'->'Fiction books from a-z', > 'list'-> Array( > 'list'-> [0]->array( > 'title'->'xzy', > 'id'->'1') > [1]->array( > 'title'->'abcd', > 'id'->'2') > ) > ) > > Now, I want to display it using smarty os it looks like > > --------------------------------------------------- > Books Result: > ---------------------------------------------------- > 1. Type: Fiction > Notes: bla bla bla bla > ---------------------- > ID | Title > ---------------------- > 1 | xzy > 2 | abcd > ---------------------- > 2. Type: Non-Fiction > Notes: bla bla bla bla > ---------------------- > ID | Title > ---------------------- > 3 | ABCDEFEGH > 4 | LALALALLA > ---------------------- > can I do like that with smarty ? and how to do that ? > I knew to use array, but for this array, I dont know how to do that You need to come up with a better way to format that array based on how you want to display it. You can then use {foreach} http://smarty.php.net/manual/en/language.function.foreach.php ---John Holmes...

« previous php.general (#193199) next »