It might also pay to create a clone of the current view object - that way you can use all the pre-existing helpers, template paths, etc but ensure you start from a 'clean slate' (in terms of template variables) before you populate your email. It will also ensure you can continue to send output to the browser, if you wish, without having already modified your view object.

E.g.

function sendmessageController()
{
    $view = clone $this->view;
    $view->clearVars();

    ...populate view...
    $htmlBody = $view->render();

    ...continue to send your mail...
}

Something like:

function emailAction() {
Zend_Controller_Front::getInstance()->setParam('noViewRenderer',true);
$body = $this->view->render("email/email.phtml");
//and then you have your content in $body, and then just send
//the email as you normally do
}

/Peter




On Wed, 2007-11-28 at 08:52 -0700, Gunter Sammet wrote:
Hi all:
Just been wondering if there is a way to render a view for an html
email that is not used in the display. I'm currently using Smarty as
template engine integrated in the view. Now I would like to send out
html emails using templates but rendering them with the data the same
way I would do for displaying in the browser.
Any thoughts?
Thanks,

Gunter


--

Simon Mundy | Director | PEPTOLAB

""" " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "

Please support Movember today!  Visit http://www.movember.com/au/donate
Registration number for Simon 160725

202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124
http://www.peptolab.com

Reply via email to