Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Template
- {
- private $params = array();
- private $template_file;
- public function __construct()
- {
- global $CONFIG;
- $this->SetParameter('site_path', $CONFIG['SITE']['PATH']);
- $this->SetParameter('web_gallery', $CONFIG['SITE']['DATA']);
- $this->SetParameter('full_name', $CONFIG['SITE']['FULL']);
- $this->SetParameter('short_name', $CONFIG['SITE']['NAME']);
- }
- private function Display($value)
- {
- $content = ROOT_PATH."/templates/".$value.".html";
- ob_start();
- require_once($content);
- $content = ob_get_contents();
- ob_end_clean();
- foreach($this->params as $param => $value)
- {
- $content = str_ireplace('{$' . $param . '}', $value, $content);
- }
- echo $content;
- }
- public function SetParameter($param, $value)
- {
- $this->params[$param] = $value;
- }
- public function AddTemplate($template_file)
- {
- return $this->Display($template_file);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement