<?php

if (preg_match('/template.php/i', $_SERVER['PHP_SELF']))
{ header ("location:index.php");
		exit;
		}

class template
{ var $TAGS=array();
		var $THEME;
		var $CONTENT;
		function define_tag($tagname, $varname)
		{ $this->TAGS[$tagname]=$varname;
				}
		function define_theme($themename)
		{ $this->THEME=$themename;
				}
		function parse()
		{ $this->CONTENT=file($this->THEME);
				$this->CONTENT=implode("", $this->CONTENT);
				foreach ($this->TAGS as $key => $val)
				{ $this->CONTENT=preg_replace('{'.$key.'}', $val, $this->CONTENT);
						}
				}
		function printproses()
		{ echo $this->CONTENT;
				}
		}

?> 