Created
May 11, 2010 02:08
-
-
Save nhaskins/396825 to your computer and use it in GitHub Desktop.
mailchimp table cleaner/font tag adder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//fontThisTable() inserts font tags before and after all the td tags. Size and style are optional. | |
function fontThisTable($someTable, $fontSize, $fontStyle){ | |
if(!$fontSize){$fontSize = '2';} | |
if(!$fontStyle){$fontStyle = 'Arial';} | |
$someTable = preg_replace('|<td.*?>|', '<td>', $someTable); | |
$someTable = preg_replace('|<td>|', '<td><font face="'.$fontStyle.'" size="'.$fontSize.'">', $someTable); | |
$someTable = preg_replace('|</td>|', '</font></td>', $someTable); | |
return $someTable; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See the problem is with email HTML is that a lot of mail clients strip out styling. In this case, I'm going to copy a table from a page, and send it to a Mailchimp template. I wanted to take the table as it was on the site, strip out class data, and then insert the font tags for each one.
Its 1996 at its finest, which means there is a good chance the majority of email clients will render this font the way i want it to happen.