/ Published in: PHP
URL: http://www.talkphp.com/general/4844-php-template.html
Expand |
Embed | Plain Text
<?php class Template{ private $dir; public function __construct($dir) { $this->dir = $dir; } else { throw PHPTemplateException('Directory does not exists'); } } public function assign($variable, $data) { $this->data[$variable] = $data; } public function display($template) { $this->__fetch($this->dir . $template); return; } throw PHPTemplateException('File does not exists'); } private function __fetch($____FILE) { include( $____FILE ); } } class PHPTemplateException extends Exception { public function __construct($message) { parent::__construct('[PHP Template]:' . $message); } }
You need to login to post a comment.
