I made an user email configurable template, where the user can enter the color and logo for his email.
I try to offer a preview of the email.
views/emailTemplate/preview.php
<?php $this->beginContent('//emailTemplate/mainTemplate'); ?>
<p>
Phasellus dictum sapien a neque luctus cursus. Pellentesque sem dolor, fringilla et pharetra vitae. consequat vel lacus. Sed iaculis pulvinar ligula, ornare fringilla ante viverra et. In hac habitasse platea dictumst. Donec vel orci mi, eu congue justo. Integer eget odio est, eget malesuada lorem. Aenean sed tellus dui, vitae viverra risus. Nullam massa sapien, pulvinar eleifend fringilla id, convallis eget nisi. Mauris a sagittis dui. Pellentesque non lacinia mi. Fusce sit amet libero sit amet erat venenatis sollicitudin vitae vel eros. Cras nunc sapien, interdum sit amet porttitor ut, congue quis urna.
</p>
<?php $this->endContent(); ?>
views/emailTemplate/mainTemplate.php (simplified version for exemple)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- If you delete this meta tag, Half Life 3 will never be released. -->
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="<?php echo Tenant::trimEditor(Yii::app()->createAbsoluteUrl("/css/emailTemplate.css")); ?>" />
</head>
<body bgcolor="<?php //I echo the body color ?>">
<?php echo $content; ?>
</body>
</html>
[color="#FF0000"]But either the css in the email overwrites the site layout or the site overwrites the email template…[/color]
[color="#006400"]How can I contain the css of the email to its view? iFrames?[/color]