path->getTemplatesPath(); craft()->path->setTemplatesPath($path); $html = craft()->templates->render($file, $vars); craft()->path->setTemplatesPath($oldPath); return TemplateHelper::getRaw($html); } /** * Renders the content of a template file using absolute path defined by $file * * @param string $file * @param array $vars * * @throws Exception * @return \Twig_Markup */ public function renderCustomTemplateString($file, array $vars = array()) { if (is_readable($file)) { $source = file_get_contents($file); $rendered = craft()->templates->renderString($source, $vars); return TemplateHelper::getRaw($rendered); } throw new Exception(Craft::t('{f} is missing or cannot be read.', array('f' => $file))); } }