ähm... ich habe mit keinem 2. satz danach gefragt. ich meinte ja die komplizierten template engines wie eben phptal usw. ich hab auch selber schon so ein ding gemacht. ganz einfach und simpel. kann man ja fast nicht template system nennen, funktioniert für mich aber ganz gut.
code datei1.php:
PHP-Code:
<?php
// hier bestimmen wir welche variablen "geparst werden sollen"
// und welche vorher durch eine datenbankabfrage erzeugt wurden
$parse = array('%HEADLINE%' => $data['ev_name'],
'%STARTDATE%' => $data['ev_startdate'],
'%ENDDATE%' => $data['ev_enddate'],
'%DESC_SHORT%' => $data['ev_desc_short'],
'%DETAILS%' => $data['ev_desc_long'];
$content = file_get_contents('tpl/datei1.tpl');
foreach($parse as $tpl => $rep) {
$content = str_replace($tpl, $rep, $content);
}
echo $content;
?>
tpl/datei1.tpl
Code:
<table cellpadding="3" cellspacing="0" border="0">
<tr>
<td width="100%">%HEADLINE% - %STARTDATE% bis %ENDDATE%</td>
</tr>
<tr>
<td>%DESC_SHORT%</td>
</tr>
<tr>
<td>%DETAILS%</td>
</tr>
</table>