I have a section "Emails" which has an entry 'Welcome Email'. The template assigned for it under Section is '_email/welcome'. This works fine when viewed in frontend. But I want to render the same template in my plugin services. The code I have used is:
$template = 'welcome'; $data = 'foo'; $oldPath = craft()->path->getTemplatesPath(); $path = craft()->path->getTemplatesPath().'_email/'; craft()->path->setTemplatesPath($path); $html = craft()->templates->render($template,$data); $breaks = array("<br />","<br>","<br/>"); $text = str_ireplace($breaks, "\r\n", $html); craft()->path->setTemplatesPath($oldPath);
But this gives an error "_email/_layout" not found in craft.log . What am I doing wrong ? Could anyone please help.
Thanks in advance.