PDA

View Full Version : plugin looping within templates doc?


sifuhall
09-22-2009, 06:07 PM
Can someone please point me to an example or doc about how to have a plugin populate two templates like this:

template A is the generic template and calls template B for each iteration of a loop

?

For example, my loop contains apples, oranges, and bananas

Template A will display something like:

Your fruit is:
$template B

So the end result is:

Your fruit is:
apples
oranges
bananas

Any help is greatly appreciated.

Lynne
09-22-2009, 06:57 PM
Something like:
while ($yourfruit = $db->fetch_array($query))
{
a bunch of stuff.....
eval('$yourfuits .= "' . fetch_template('your_fruit') . '";');
}
eval('print_output("' . fetch_template('list_of_fruits') . '");');


your_fruit is just a template that uses the variable $yourfruit
list_of_fruits is just a template that has "Your fruit is: $yourfruits" in it.

sifuhall
09-22-2009, 07:09 PM
Thanks, Lynne!