Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By markhope on
I'm producing a newsletter with simplenews.module having applied a patch to include support for mimemail.module.
The outgoing mail has a theme function:
/**
* Themeable message body for newsletter
*/
function phptemplate_mimemail_message($body) {
$output = '<html><head><style type="text/css"><!--';
// include a stylesheet specifically for the newsletter
// i need to reference an external css file here
// something like include_once("/path/to-my/extenal.css");
$output .= '--></style>';
$output .= '</head><body id="mimemail-body">';
$output .= '<div id="newsletter-header" style="border: 1px solid black;">Sitename</div>';
$output .= '<br />'.$body.'</body></html>';
// compress output
return preg_replace('/\s+|\n|\r|^\s|\s$/',' ',$output);
}
?>
Is there an easy way to print the contents of an external file, html or css using an include?
Mark
Comments
The answer is file_get_contents