Okay well I see I have reopened the can of worms lol. > This has all been done before, and I'm assuming that the James knows, > and has seen that before, since he used the same common method names, > as is in many php templating systems. $class->assign has been used in > any templating system I've ever seen(although to be honest I haven't > seen that many). > > I don't think the fact that it has been done before should inhibit him > from doing it again. Carrying out the process, is one of the most > educational ways, and perhaps one of the most enlightening ways to see > how a process works. Rory you are my hero! you took the words right out of my mouth, and yes, I am looking to create a small basic one that isn't bloated with useless features. Basically variable replacement mostly. Anyways, I restructered my code, and as far as I can see there is nothing wrong with the code, except for that it simply doesn't work :) I'm probably missing something blatently obvious but I'll post it and maybe someone can spot why this isn't working. Here be the code: <?php class mm { // // PRIVATE CLASS VARIABLES // var $_file; var $_template; var $_var; var $_value; // // CLASS CONSTRUCTOR // function mm() { $this->_var = array(); $this->_value = array(); } // // ASSIGN A VARIABLE // function assign($var,$value) { if (isset($var) && isset($value)) { $this->_var[] = $var; $this->_value[] = $value; } } // // RUN THE WEBPAGE // function run($template) { if (isset($template)) { $this->_template = 'tpl/' . $template . '.tpl'; if (file_exists($this->_template)) { $file = fopen($this->_template,'r'); $this->_file = fread($file,filesize($this->_template)); fclose($file); $this->_file = str_replace('{' . $this->_var . '}',$this->_value,$this->_file); print($this->_file); } else { print('<p>Template File Does Not Exists</p>'); } } else { print('<p>Template is not sent</p>'); exit; } } } ?> The page that run's the script simply looks like this: <?php // // LOAD THE TEMPLATING CLASS // require_once('tpl.php'); $mm = new mm(); // // SET CONTENT // $sitename = 'Calgary Outdoor Paintball League » Under Heavy Developement'; $header = 'Welcome to the Calgary Outdoor Paintball League\'s Official Website'; // // RUN THE PAGE // $mm->assign('sitename',$sitename); $mm->assign('header',$header); $mm->run('index'); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php