Today I ran into this really great article:
Archive for December, 2009
On Accessibility
Thursday, December 10th, 2009Zend Framework: Email templating with layouts & views
Wednesday, December 2nd, 2009This is a solution that I came up with for sending out welcome emails, comment notifications, etc, with nice standardized HTML & text layouts, using a few components of the Zend Framework.
Basically you create a view (here called $renderer) and a layout ($layout), then render your views and layouts for both HTML and text versions. My file tree looks like this:
application/ emails/ welcome.html.phtml welcome.text.phtml layouts/ layout.html.phtml layout.text.phtml
So, ‘welcome’ would be your template name, with html and text versions. The layout is what you want wrapped around either version of every email you send out (header graphics, font settings, contact info, etc).
