Re: [SMARTY] Using smarty to collect data in a php loop
| From: | Jason Sweat | Date: | Sat, 27 Apr 2002 19:07:22 +0000 |
| Subject: | Re: [SMARTY] Using smarty to collect data in a php loop | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3909@lists.php.net to get a copy of this message | ||
Gerard,
You might want to take a look at a tutorial I wrote located at
http://www.zend.com/zend/tut/tutsweatpart1.php
. It demonstrates the use of
a database abstraction layer to load arrays for presentation with Smarty.
This tutorial uses PEAR::DB, but I prefer to use ADOdb now
(http://php.weblogs.com/ADOdb).
Regards,
Jason
----- Original Message -----
From: "Brian E. Lozier" <brian@massassi.net>
To: "smarty" <smarty-general@lists.php.net>; "Gerard Samuel"
<gsam@trini0.org>
Sent: Saturday, April 27, 2002 12:43 PM
Subject: Re: [SMARTY] Using smarty to collect data in a php loop
> You'd probably want to use a section since it's a numerical array. But
your syntax is off, you'll want to do
> it like this:
>
> $foo[] = $row[0];
>
> 4/26/02 10:06:43 PM, Gerard Samuel <gsam@trini0.org> wrote:
>
> >Please forgive me. Im a bit new to smarty...
> >Im wondering about looping through some database results to collect data
> >for smarty.
> >
> >while ($row = mysql_fetch_row($sql)) {
> > $foo = $row[0];
> >}
> >
> >Is it possible to then pass $foo to $smarty like so
> >$smarty->assign("bar", $foo);
> >where $foo is a numeric array??
> >And then run a foreach or the like on the array in the template.
> >
> >Thanks for listening...
> >
> >
> >--
> >Smarty General Mailing List (http://smarty.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
> Brian
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>