Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not sure if this is best practice, but what I did is extend Zend_Mail with methods like these:</p> <pre><code>setTemplatePath( $templatePath ); setTemplateHtml( $templateHtml ); setTemplateText( $templateText ); setTemplateArguments( array $templateArguments ); </code></pre> <p>...then at some point in my overwritten<code>send()</code> I do:</p> <pre><code>$view = new Zend_View(); $view-&gt;setScriptPath( $this-&gt;_templatePath ); foreach( $this-&gt;_templateArguments as $key =&gt; $value ) { $view-&gt;assign( $key, $value ); } if( null !== $this-&gt;_templateText ) { $bodyText = $view-&gt;render( $this-&gt;_templateText ); $this-&gt;setBodyText( $bodyText ); } if( null !== $this-&gt;_templateHtml ) { $bodyHtml = $view-&gt;render( $this-&gt;_templateHtml ); $this-&gt;setBodyHtml( $bodyHtml ); } </code></pre> <p>So to utilize this you would do something like:</p> <pre><code>$mail = new My_Extended_Zend_Mail(); $mail-&gt;setTemplatePath( 'path/to/your/mail/templates' ); $mail-&gt;setTemplateHtml( 'mail.html.phtml' ); $mail-&gt;setTemplateText( 'mail.text.phtml' ); $mail-&gt;setTemplateArguments( 'someModel' =&gt; $someFunkyModel, /* etc, you get the point */ ) $mail-&gt;send(); </code></pre> <p>In other words, with this you can let your designers and copywriters simply edit views (templates) like they are used to already. Hope this helps and has inspired you to come up with something funky that suits your needs.</p> <p><strong>PS:</strong><br> Since you mention arbitrary data rows, you can, for instance, utilize the <a href="http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.partial" rel="nofollow noreferrer">partialLoop</a> view helper that comes with ZF for this. But you probably were aware of this already?</p> <p><strong>PPS:</strong><br> I actually agree with chelmertz' comment about not extending Zend_Mail but wrapping it in my own component.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload