20.04.2003, 22:22
das mit php statt frames is ja ganz lustig aber wenns mal was anständiges machen wollts versucht es mal mit php fast template
http://www.thewebmasters.net/php/FastTemplate.phtml
die template dateien eines wbb2 scheinen eine erweiterte form davon zu sein oder zumindest sowas ähnliches (i hab bis jetzt noch nichts gefunden um variablen direkt in a tpl einzufügen musst die vorher immer parsen)
schaut zwar kompliziert aus is aber extrem flexibel und sauschnell
http://www.thewebmasters.net/php/FastTemplate.phtml
die template dateien eines wbb2 scheinen eine erweiterte form davon zu sein oder zumindest sowas ähnliches (i hab bis jetzt noch nichts gefunden um variablen direkt in a tpl einzufügen musst die vorher immer parsen)
Zitat:This example will build an HTML page that will consist of a table. The table will have 3 numbered rows. The first step is to decide what templates we need. In order to make it easy for the table to change to a different number of rows, we will have a template for the rows of the table, another for the table, and a third for the head/body part of the HTML page.
Below are the templates. (Pretend each one is in a separate file.)
<!-- NAME: main.tpl -->
<html>
<head><title>{TITLE}</title>
</head>
<body>
{MAIN}
</body>
</html>
<!-- END: main.tpl -->
<!-- NAME: table.tpl -->
<table>
{ROWS}
</table>
<!-- END: table.tpl -->
<!-- NAME: row.tpl -->
<tr>
<td>{NUMBER}</td>
<td>{BIG_NUMBER}</td>
</tr>
<!-- END: row.tpl -->
Now we can start coding...
/* START */
<?
include("class.FastTemplate.php3");
$tpl = new FastTemplate("/path/to/templates");
$tpl->define( array( main => "main.tpl",
table => "table.tpl",
row => "row.tpl" ));
$tpl->assign(TITLE,"FastTemplate Test");
for ($n=1; $n <= 3; $n++)
{
$Number = $n;
$BigNum = $n*10;
$tpl->assign( array( NUMBER => $Number,
BIG_NUMBER => $BigNum ));
$tpl->parse(ROWS,".row");
}
$tpl->parse(MAIN, array("table","main"));
Header("Content-type: text/plain");
$tpl->FastPrint();
exit;
?>
When run it returns:
<!-- NAME: main.tpl -->
<html>
<head><title>FastTemplate Test</title>
</head>
<body>
<!-- NAME: table.tpl -->
<table>
<!-- NAME: row.tpl -->
<tr>
<td>1</td>
<td>10</td>
</tr>
<!-- END: row.tpl -->
<!-- NAME: row.tpl -->
<tr>
<td>2</td>
<td>20</td>
</tr>
<!-- END: row.tpl -->
<!-- NAME: row.tpl -->
<tr>
<td>3</td>
<td>30</td>
</tr>
<!-- END: row.tpl -->
</table>
<!-- END: table.tpl -->
</body>
</html>
<!-- END: main.tpl -->
If you're thinking you could have done the same thing in a few lines of plain PHP, well yes you probably could. But, how would a graphic designer tweak the resulting HTML? How would you have a designer editing the HTML while you're editing another part of the code? How would you save the output to a file, or pipe it to another application? How would you make your application multi-lingual? How would you build an application that has options for high graphics, or text-only? FastTemplate really starts to shine when you are building mid to large scale web applications, simply because it begins to seperate the application's generic logic from the specific implementation.
schaut zwar kompliziert aus is aber extrem flexibel und sauschnell
Write this on my gravestone, write this right on my grave, "To whisky and women, here lies a poor slave".
Computer- und Mediensicherheit - FH Hagenberg
Hagenberger Kreis zur Förderung der digitalen Sicherheit
Security Forum
Computer- und Mediensicherheit - FH Hagenberg
Hagenberger Kreis zur Förderung der digitalen Sicherheit
Security Forum