On Wed, Aug 11, 2010 at 12:22 PM, Hector Virgen <djvir...@gmail.com> wrote:

> You could also use a partial. Partials handle the cloning/var-clearing for
> you.
>
> Also, be careful with getViewScript(), because it adds a suffix based on
> the context. It's .phtml by default, but it could be .ajax.phtml if you're
> using the AjaxContext action helper.
>
> --
> Hector Virgen
> Sent on my Droid X
>

Regarding using a partial, do you mean something like this?

<?php

$mail->setBodyHtml( $this->view->partial( 'emails/client.phtml' ) );

?>

That would probably be a lot cleaner.

The only "problem" I see with that method—in my case, specifically—is that I
send two slightly different emails containing roughly the same information;
one to our client(s), the other as an internal notification. Using a full
view object allows me to assign the view variables once, then render two
different scripts.

I'm not opposed to assigning the information for each email (it may be good
to enforce some separation), but is there a way to avoid this? I think
placeholders would do the trick, but it sounds like anything put in a
placeholder would be available to all view scripts, not just the
email-related scripts. Hmm...


Thanks,
Ryan

Reply via email to