Home > Archive > PHP Smarty Templates > June 2004 > Nesting
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| George Pitcher 2004-06-09, 3:57 am |
| Hi,
An appropriate subject considering I work for an organisation named 'Heron'.
I am using Smarty with PEAR:DB/MySQL. Some of my pages are lists of reading
materials being sent to an agency for permission to scan etc. I present my
data as:
Course 1 (displaying several items of course information
Extract 1 (ditto but for the extract)
Extract 2 (ditto but for the extract)
Extract 3 (ditto but for the extract)
Extract 4 (ditto but for the extract)
Course 2 (displaying several items of course information
Extract 5 (ditto but for the extract)
Extract 6 (ditto but for the extract)
Extract 7 (ditto but for the extract)
Extract 8 (ditto but for the extract)
and so on until all courses and extracts have been handled.
So far I've been doing this conventionally by performing nested loops in
php, and comparing the Extracts course_id with the pack to see if a new pack
loop needs to be started. Its worked well so far.
I'm not sure how I should tackle this in Smarty. Any clues or pointers?
MTIA
George in Oxford
| |
| Justin Patrin 2004-06-09, 8:58 pm |
| George Pitcher wrote:
> Hi,
>
> An appropriate subject considering I work for an organisation named 'Heron'.
>
> I am using Smarty with PEAR:DB/MySQL. Some of my pages are lists of reading
> materials being sent to an agency for permission to scan etc. I present my
> data as:
>
> Course 1 (displaying several items of course information
> Extract 1 (ditto but for the extract)
> Extract 2 (ditto but for the extract)
> Extract 3 (ditto but for the extract)
> Extract 4 (ditto but for the extract)
>
> Course 2 (displaying several items of course information
> Extract 5 (ditto but for the extract)
> Extract 6 (ditto but for the extract)
> Extract 7 (ditto but for the extract)
> Extract 8 (ditto but for the extract)
>
> and so on until all courses and extracts have been handled.
>
> So far I've been doing this conventionally by performing nested loops in
> php, and comparing the Extracts course_id with the pack to see if a new pack
> loop needs to be started. Its worked well so far.
>
> I'm not sure how I should tackle this in Smarty. Any clues or pointers?
>
> MTIA
>
>
> George in Oxford
Use youre loops to store the data, then pass it into smarty to be
rendered. Yes, this means you have to loop twice...
--
paperCrane <Justin Patrin>
|
|
|
|
|