Open Sogl opened 7 years ago
you could use someting like https://github.com/jjriv/emogrifier or the much simpler Kwc_Mail_HtmlParser
.
you can integrate both by subclassing Kwf_Mail_Template and overriding _getHtmlMailContent
you could use someting like https://github.com/jjriv/emogrifier
Do you mean something like this:
$html = '<html><h1>Hello world!</h1></html>';
$css = 'h1 {font-size: 32px;}';
$emogrifier = new \Pelago\Emogrifier($html, $css);
?
But how to insert template variables in loop (including txt.tpl
template too)?
I think I didn't understand your question. I thought you want to avoid duplicating the p style attribute.
.tpl files are interpreted as real php files, you can use any <?php if for <?php foreach or whatever you need
I mean that I want to use something like Twig loop functions in template: http://twig.sensiolabs.org/doc/2.x/tags/for.html
Also in Laravel Blade templates (Loops section): https://laravel.com/docs/5.4/blade#control-structures
Then I can send array to template for the loop to avoid using html/css in php.
That's how Zend_View_Template works (by default) - those .tpl files are php files and to create a loop simply use
<?php foreach ($this->foos as $foo) { ?>
<?=$foo?>
<? } ?>
Twig templates are currently not supported by Kwf_Mail_Template, you could however use Twig to render a template and Kwf_Mail with setBodyHtml
Hi!
Duplicate lines
I have generated style from css mail framework:
I can use it as
Kwf_Mail_Template
variable:But I have different lines so I need to have final output using php loop:
How to duplicate lines without putting html tags to my php content?
Delete lines
I have some buttons in mail that I want to delete/exclude using php conditions. How to delete parts from my
.tpl
file in php?