Re: [SMARTY] Newbie Q: was recursive loops, how to do w/Smarty?
[email protected] (Bjørge Solli) Wed, 6 Dec 2006 15:48:13 +0100
| Newsgroups | php.smarty.general |
|---|---|
| Message-ID | <[email protected]> |
Hi,
of course. I am more puzzled on how to build the tables in the php-part, so
that section/foreach can be used easily.
Sorry for beeing unclear.
/Bjørge
On Wednesday 06 December 2006 15:30, Monte Ohrt wrote:
> Use a nested {section} or {foreach} loop in the template.
>
> Bjørge Solli wrote:
> > Hi
> >
> > I'm a beginner at this, but love the concept.
> > Use table sized spoons when answering..
> >
> > I have something that I normally would code like this:
> > <loop1>
> > SQL-query1
> > ...
> > <loop2>
> > SQL-query2, using the result of SQL-query1 as a part of the query
> > ...
> > </loop2>
> > </loop1>
> >
> > How to do this best with Smarty?
> >
> > The data is ordered something like this:
> > TABLE1:
> > fields: id, info1, info2,...
> >
> > TABLE2:
> > fields: id, table1-ref-id, date, info1, info2,...
> >
> > One entry in TABLE1 has many (thousands) referencing entries in TABLE2. I
> > generally have thousands of entries in TABLE1, each having thousands of
> > entries in TABLE2, so this generates a lot of data to be shown - hence I
> > use the info-fields to select the desired output area.
> >
> > Another small Q:
> > I also use SQL-SELECTs with LIMIT, to limit the size of the page, but I
> > find this to be a part of presentation, not business logic. Is the best
> > way to use .total and .iteration for this?
> >
> > My code looks so much nicer using Smarty, many thanks to all developers!
--
Bjørge