[themes] include external code in theme function

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


will that print the contents of the css file to the outgoing mail?

What I want to achieve is:
<style type="text/css"><!--
   /*the contents of the css file printed...*/
body {
   margin: 0;
   padding: 0;
}
p {
   font-size: 36px;
   color: red;
}
--></style>

I don't want to link to the stylesheet.

Mark

On 20 Dec 2006, at 19:01, Farsheed wrote:

> You can add styles in an easier way:
>
> $path = path_to_theme();
> theme_add_style( $path.'/style.css');
>
> http://api.drupal.org/api/4.7/function/theme_add_style
>
>
> --- Mark Hope <mark at markhope.net> wrote:
>
>> 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
>>
>> _______________________________________________
>> themes mailing list
>> themes at drupal.org
>> http://lists.drupal.org/mailman/listinfo/themes
>>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> themes mailing list
> themes at drupal.org
> http://lists.drupal.org/mailman/listinfo/themes
>



More information about the themes mailing list