views:

42

answers:

1

I would like to use a layout for the emails I'm sending out. I'm currently usine Zend Layout for the web pages, but would like to theme my emails as well.

Here is what I've tried.

This is my function that sends the email

    $layout = Zend_Layout::getMvcInstance();
    $this->_view->render($template);
    $html = $layout->render('email');
    $this->setBodyHtml($html,$this->getCharset(), $encoding);
    $this->send();

The email layout is simply

    The email content
    <?php echo $this->layout()->content; ?>

When it comes through as an email it just has...

    The email content
A: 

Have you considered just using Zend_View to generate your email template?

Chris
It is using Zend_View for the email template. I want to have a master template that I inject a specific template into, exactly like Zend_Layout does for web pages.
nvoyageur
Well I'm asking because in that case you need to use the Layout component in standalone mode: http://framework.zend.com/manual/en/zend.layout.quickstart.html
Chris
In the end, I'm just using Zend_View with `<?php echo $this->render('mail_header.phtml'); ?>` before the content and `<?php echo $this->render('mail_footer.phtml'); ?>` after the content. Just like the good old days of PHP header and footer includes :)
nvoyageur