Hab folgenden PHP-Code:
tpl-File body-tag:
Aber die HTML-File wird nicht korrekt gefüllt. Ausgabe-Quelltext:
Kann mir jemand sagen, wieso das nicht geht (vor allem weil es ein Beispiel-Code von KTemplate ist...
)??
Danke, Neo2k3
Code:
<?php
include ("./../inc/class_ktemplate.inc.php");
$t = new KTemplate("./../tpl/welcome.tpl");
$t->assign("hallo", "bla");
$t_table = $t->fetchBlock("table");
$t_row = $t_table->fetchBlock("row");
$t_col = $t_row->fetchBlock("col");
// build a table with 5 rows and 5 columns
for ($row = 1; $row <= 5; $row++)
{
for ($col = 1; $col <= 5; $col++)
{
// assign a string to the column placeholder object instance
$t_col->assign("cellcontent",$col);
// put column object instance into row object
$t_row->assign("col",$t_col);
$t_col->reset();
}
// put row into table
$t_table->assign("row",$t_row);
$t_row->reset();
}
// put the complete table object into the main template
$t->assign("table",$t_table);
// print the results
$t->out();
?>
Code:
<table border="1">
<tr>
<td>
{cellcontent}
</td>
</tr>
</table>
Code:
bla
<table border="1">
<tr>{col}</tr>
<tr>{col}</tr>
<tr>{col}</tr>
<tr>{col}</tr>
<tr>{col}</tr>
</table>
Danke, Neo2k3

Kommentar