[php] fast template loop

Pagina: 1
Acties:

Onderwerpen


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Hallo,
Ik wil graag een loop in mijn templates hebben.
Ik gebruik nu dit:
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
include("class.FastTemplate.php3");
$tpl = new FastTemplate("./templates");

$bestanden['agenda'] = "agenda.tpl";

$tpl->define($bestanden);

$tpl->assign(array("{TITEL}" => "Dit is een test template"));

for($i = 0; $i < 100; $i++){

  $tpl->assign(array("{I}" => $i));

$tpl->parse("OUTPUT","agenda");

$tpl->FastPrint("OUTPUT");

}

?>

Maar ik vind dat het beter kan, dat je bij elke $i FastPrint uitvoert. Weet iemand hoe ik dat kan doen, en of het mogelijk is?

Alvast bedankt voor jullie reactie,
Groet Rian

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
include("class.FastTemplate.php3");
$tpl = new FastTemplate("./templates");

$bestanden['agenda'] = "agenda.tpl";
$bestanden['i'] = "i.tpl";

$tpl->define($bestanden);

$tpl->assign(array("{TITEL}" => "Dit is een test template"));

$tpl->define_dynamic("row","agenda");

for($i = 0; $i < 100; $i++){

  $tpl->assign(array("{I}" => $i));

  $tpl->parse("INPUT",".row");

}

$tpl->parse("OUTPUT","agenda");

$tpl->FastPrint("OUTPUT");

?>


Het is gelukt.

Groet Rian