On Wed, Sep 17, 2008 at 10:58 AM, Francois Zaninotto
<[EMAIL PROTECTED]> wrote:

>> And it will allow to set vars for the
>> whole email class and to having to pass them every time like this:
>
> Not sure I get you.

I mean, how do you pass dynamic fields to your partials? The
get_partial() functions accept an array of variables to render the
template:

function get_partial($templateName, $vars = array());

This is important to me because you usually will want to use the same
vars for both the text/plain and the text/html parts (and why not also
for a dynamically generated application/pdf one)?

> Does in mean that you define one single action (mail/foo), and symfony
> (1.1) uses its multiformat support to render both a text and an HTML
> part? That might be possible if the templates dir of the mail module
> looked like:
>
>    modules/mail/templates/
>      _foo.txt.php
>      _foo.html.php

Yes, that's what I proposed in my first message, but I don't know if
it's not a bit too much magic?

> My proposal of using the already available partial/component helpers
> (or an OO equivalent) decouples the sfMail class from the symfony view
> layer and relies on current knowledge, without introducing new class
> constants or classes.

> If the tradeoff is to have to define explicitely
> both parts and set a variable before to give html and text parts the
> same array of arguments (that's two lines of code), that's a price I'm
> willing to pay.
> You are already going way further than what Django or Rails propose. I
> think KISS is the objective here.

If everybody agree on this, we can just provide the environment
handling system using the factories.yml file, and let the users choose
their way to retrieve body contents, using get_partial() and use use
the existing SwiftMailer API...

++

-- 
Nicolas Perriault
http://prendreuncafe.com - http://symfonians.net - http://sensiolabs.com
Phone: +33 660 92 08 67

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to