Hab schon in unzähligen Foren um rat gefragt.
Ich bekomme einfach nicht zustande das die Templates richtig geparst werden.
index.php:
Code: Alles auswählen
<?
$tmpl_name = 'index.tpl';
$tmpl_content[title] = 'echo "blabla";
$gaga = 123 + 123;
echo $gaga;';
$tmpl_content[text] = 'echo "Hallo Welt";
$baba = 999 * 999;
echo $baba;';
require_once('./templates/class_template.php');
template ($tmpl_name, $tmpl_content);
echo $work;
?>
Code: Alles auswählen
<html>
<head>
<title>%%title%%</title>
</head>
<body><center>%%text%%</center>
</body>
</html>
Code: Alles auswählen
<?
function template ($tmpl_name, $tmpl_content) {
$dir = 'c:\\intranet\\Apache2\\htdocs\\test\\templates';
global $work;
$pfad = "".$dir."\\".$tmpl_name."";
$tmpl = file_get_contents($pfad);
if ( trim($tmpl) != "" ) {
$work = $tmpl;
while ( list( $key, $val ) = each( $tmpl_content ) ) {
$x = "%%" . strtolower($key) . "%%";
$work = str_replace($x, "<?".$val."?>", $work);
}
}
return $work;
}
?>
Ich hab auch schon eval() ausprobiert nix führt zum erfolg
