Hi,
Given that Symfony is built around templates, I am trying to figure out how
I can leverage the power of the templates for other things, such as emails.
For example, I would like to write up my email in a template form, then
simply pass it the necessary variables to populate it. Finally, if I could
"get" the output as text, I could assign it to the body of my mail, and off
I go. That would allow me to separate the contents from my action.
I've checked the docs, but haven't found anything that really explains how I
could make something like this work. For instance, I'd love to be able to
do somehting like:
// start pseudo-code
$emailTemplate = new Template("myEmailTemplateName" );
$emailTemplate->setVar( $user );
$body = $emailTemplate->getMergedTemplate();
// end psuedo-code
$email = Swift_Message::newInstance();
$email->setFrom( "[email protected]" );
$email->setTo( $user->getEmail() );
$email->setSubject( "subject line" );
$email->setBody( $body );
$this->getMailer()->send( $email );
Then in the "myEmailTemplate" I'd be able to put in whatever text I wanted.
Do I need to install another template engine plugin for something like
this? Or can I use what Symfony already has?
Thanks!
Eric
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" 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-users?hl=en