<?php class simpleTemplate { var $toChange; var $str; function simpleTemplate() { $this -> str = ''; } function setTemplate($ATemplate) { $this -> str = $ATemplate; } function loadFromFile($AFileName) { } function addChange($AKey, $AValue) { $this -> toChange[$AKey] = $AValue; } function executeChanges() { foreach ($tmpKeys as $currentKey) { $this -> toChange[$currentKey], $this -> str); } } return $this -> str; } } ?>
szablon.tpl:
index.php:
<?php nclude_once('parser.php'); $st = new simpleTemplate(); $st -> loadFromFile('szablon.tpl'); $st -> addChange('{title}', "Tytuł"); $st -> addChange('{content}', "INCLUDOWANIE"); ?>
własciwie wszystko jest ok tylko mam problem jezeli tam gdzie mam {content} chciałbym zaincludować plik (zeby zamiast {content} pojawiło sie <? include("content.php"); ?>