public function render($template, array $vars = array())
    {
        // Make sure template file isn't empty string
        if (empty($template)) {
            throw new LogicException('Empty template name provided');
        }

        if (!$this->templateExists($template)) {
            $base = $this->createPath(self::TEMPLATE_PARAM_BASE_DIR, dirname($this->moduleDir), $this->module, $this->theme);
            throw new RuntimeException(sprintf('Cannot find "%s.%s" in %s', $template, self::TEMPLATE_PARAM_EXTENSION, $base));
        }

        // Template file
        $file = $this->createInclusionPath($template);

        $this->addVariables($vars);

        if ($this->hasLayout()) {
            $layout = $this->createInclusionPath($this->layout, $this->layoutModule);

            $content = $this->createContentWithLayout($layout, $file);
        } else {
            $content = $this->createFileContent($file);
        }

        // Compress if needed
        if ($this->compress === true) {
            $compressor = new HtmlCompressor();
            $content = $compressor->compress($content);
        }

        return $content;
    }