<?php
/**
 * @package		Ad Platform
 * @author		Uta Marian - Alexandru ( -uMarian- )
 * @license		http://codecanyon.net/licenses
 * @link		http://www.uta-marian.com
 * @version		Version 1.0
 */
 
class template {
  private $vars  = array();
 
  public function __get($name) {
    return $this->vars[$name];
  }
 
  public function __set($name, $value) {
    if($name == 'view_template_file') {
      throw new Exception("Cannot bind variable named 'view_template_file'");
    }
    $this->vars[$name] = $value;
  }
 
  public function render($view_template_file) {
    if(array_key_exists('view_template_file', $this->vars)) {
      throw new Exception("Cannot bind variable called 'view_template_file'");
    }
    extract($this->vars);
    ob_start();
    include($view_template_file);
    return ob_get_clean();
  }
}
?>