2009年12月8日星期二

Re: [fw-mvc] Use Zend_Layout for email?

I don't see why you can't use Zend_Layout, but as you won't be getting some of the benefits, you might simply want to render a view into a variable and set that variable in another view and render that:

Something like this:

$outerview = new Zend_View;
$outerview->content = $outerview->render('innerview');

echo $outerview->render('outerview');

If all you want to do is make it easier to have many emails with the same header, etc.

Other than that, Zend_Layout can certainly be used outside of Zend Framework...in fact the whole point of Zend Framework is that you can pick and choose components. There is no mandate that a ZF project only use ZF components, and vice versa.

On Tue, Dec 8, 2009 at 5:33 PM, Nathan Garlington <garlinto@gmail.com> wrote:
I have a dated email generation system I use for sending online order-fulfillment email notifications as well as other emails used to interact with users on our site. I am refactoring some parts of our order fulfillent system and want to update the templating system for email generation as well, preferably using Zend. The current site is built around ZF but the email backend is still backwoods, if you know what I mean.

Symantically, Zend_Layout is designed to render a basic layout that can then be merged with content from a view script. Looking at the docs, it seems that to use Zend_Layout as a stand-alone object, it becomes a self-contained rendering engine. Would using this tool to generate email content be in line with it's purpose, or would I use an instance of Zend_View for this? What has everyone else done in this situation? I would like to use the ZF the way it was intended, so your collective input would be appreciated.

--
regards,

Nathan Garlington
www.tandrtrailer.com

没有评论: