[themes] include external code in theme function

Mark Hope mark at markhope.net
Wed Dec 20 19:03:20 UTC 2006


I'm trying to override the theme function for mimemail_message, to  
include css code for a html email.
Basically I'm looking for the easy/lazy way of outputting the  
newsletter.css from an include file.

My feeble attempt that doesn't work...

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

What's the best way of doing this?

Mark



More information about the themes mailing list