public function loadTemplate($template)
{
if (!file_exists($template)) {
$this->templateName = self::TEMPLATE_NAME;
$this->loader = new Twig_Loader_Array(array(self::TEMPLATE_NAME => $template));
$this->template = new Twig_Environment($this->loader);
} else {
$pathParts = pathinfo($template);
$this->templateName = $pathParts['filename'] . '.' . $pathParts['extension'];
$this->loader = new Twig_Loader_Filesystem($pathParts['dirname']);
$this->template = new Twig_Environment($this->loader);
}
return true;
}