index.tpl
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="top"> <table width="700" border="0" cellpadding="4" cellspacing="10"> <tr> </tr> <tr> </tr> <tr> </tr> </tr> </table> </body> </html>
template.class.php
<?php class TemplateSTCMS { public $TemplateSTCMS; public $DaneSTCMS; public $ParsedSTCMS; public function __construct( $name ){ }else{ echo\"Plik szablonu <b>$name</b> nie instieje\"; exit; } }else{ exit; } } public function parse( ){ return $this -> ParsedSTCMS = preg_replace('/{([^}]+)}/e', '$this -> DaneSTCMS[\"1\"]', $this -> TemplateSTCMS); } public function show( ){ } public function destruct__( ) { } } ?>
test.php
<?php include'template.class.php'; $tSTCMS = new TemplateSTCMS( 'index.tpl' ); 'TYTUL' => 'tytul strony', 'TRESC' => 'srodek strony', 'MENU1' => 'menu 1 menu 1 menu 1', 'MENU2' => include \"$url\", 'STOPKA' => 'stopka stopka stopka', 'LOGO' => 'Bla bla bla' ); $tSTCMS -> parse(); $tSTCMS -> show(); $tSTCMS -> destruct__(); ?>
inc.php
<?php ?>