hallo
ich habe da ein
problem
meine templates class sieht so aus.
ich habe da ein
Code:
<if($katid=="10")><then>mein text</then></if>
meine templates class sieht so aus.
PHP-Code:
<?php
class tpl {
function tpl($templatefolder, $end) {
$this->templatefolder = $templatefolder;
$this->end = $end;
}
function get($templatename) {
$this->templatename = $templatename;
if(file_exists($this->templatefolder."/$templatename.tpl")) $this->template =
implode("", file($this->templatefolder."/".$this->templatename.".".$this->end));
else echo "<font color=\"#FF0000\"><b>!!! das $templatename ist nicht vorhanden !!!</b></font><br>";
$this->template = str_replace('"', "###", $this->template);
return $this->template;
}
function output($output) {
$this->output = $output;
$this->output = str_replace("###", '"', $this->output);
$this->output = preg_match_all("!<if(.*)><then>(.*)</then></if>!sieU", "<\?php if(\1) {\n\t\2\n} \?>", $this->output);
$this->output = preg_match_all("!<if(.*)><then>(.*)</then><else>(.*)</else></if>!sieU",
"<\?php if(\1) {\n\t\2\n} else {\n\t\3\n} \?>", $this->output);
echo $this->output;
}
}
?>
Kommentar