Beispiel #1
0
  public function Load($name)
  {
    if (Profiling::IsProfilingEnabled() && !isset($this->usage[$name]))
      $this->usage[$name] = 0;

    // First check the memory cache.
    if (isset($this->cache[$name]))
      return clone $this->cache[$name];

    // Then check if the cache backend has it.
    $template = $this->_QueryCache($name);
    if ($template) {
      $this->cache[$name] = $template;
      return clone $template;
    }

    // Finally, parse and cache the template.
    $template = $this->_Load($name);
    $this->cache[$name] = $template;
    return clone $template;
  }
Beispiel #2
0
  public function Render($vars = array())
  {
    $__template_data = $this->data;
    $__template_vars = array_merge($this->vars, $vars);
    $render = function () use ($__template_data, $__template_vars) {
      extract($__template_vars);
      eval('?>' . $__template_data . '<' . '?');
    };

    ob_start();

    $error = error_reporting();
    error_reporting($error & ~E_NOTICE);

    $render();

    error_reporting($error);

    if (Profiling::IsProfilingEnabled())
      TemplateLoader::GetInstance()->MarkTemplateRendered($this->name);

    $data = ob_get_contents();
    ob_end_clean();
    return $data;
  }