protected function getTemplate($tpl, $outputtype = '', $trusted = true)
    {
        $tpl = $this->config->templatePath.$tpl;
        if ($outputtype == '') {
            $outputtype = 'html';
        }

        $cachefile = dirname($this->_templateName).'/';
        if ($cachefile == './') {
            $cachefile = '';
        }

        if ($this->config->cachePath == '/' || $this->config->cachePath == '') {
            throw new Exception('cache path is invalid ! its value is: "'.$this->config->cachePath.'".');
        }

        $cachefile = $this->config->cachePath.$cachefile.$outputtype.($trusted ? '_t' : '').'_'.basename($tpl);

        $mustCompile = $this->config->compilationForce || !file_exists($cachefile);
        if (!$mustCompile) {
            if (filemtime($tpl) > filemtime($cachefile)) {
                $mustCompile = true;
            }
        }

        if ($mustCompile) {
            $compiler = $this->getCompiler();
            $compiler->compile($this->_templateName,
                               $tpl, $outputtype, $trusted,
                               $this->userModifiers, $this->userFunctions);
        }
        require_once $cachefile;

        return md5($tpl.'_'.$outputtype.($trusted ? '_t' : ''));
    }