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

markhope’s picture

/**
 * Themeable message body for newsletter
 */
function phptemplate_mimemail_message($body) {
  $output = '<html><head><style type="text/css"><!--' ;
  // include a stylesheet specifically for the newsletter
  $css = file_get_contents("$_SERVER[DOCUMENT_ROOT]/mysite/modules/contrib/simplenews/newsletter.css");
  $output .= $css;
  $output .= '--></style>';
  $output .= '</head><body id="mimemail-body">';
  $output .= '<div id="newsletter-header" style="border: 1px solid black;">Site Title or logo</div>';
  $output .= '<br />'.$body.'</body></html>';
  // compress output
  return preg_replace('/\s+|\n|\r|^\s|\s$/',' ',$output);
}