Newbie Q: was recursive loops, how to do w/Smarty?
[email protected] (Bjørge Solli) Wed, 6 Dec 2006 14:10:01 +0100
| Newsgroups | php.smarty.general |
|---|---|
| Message-ID | <[email protected]> |
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