These occurs when using clean urls and under paths not under root.. so example,

user/uid .. it would look for the styles in
user/modules/onlinestatus/style.css instead of
/modules/onlinestatus/style.css

so this patch brings in global $base_url and fixes that. We can't simply just add a / in it because some people put their installs in a folder to it self.

CommentFileSizeAuthor
#2 css_fix.patch863 bytesAnonymous (not verified)
broken_style_css_link.patch984 bytesAnonymous (not verified)

Comments

xeniac’s picture

I reconfigured my local apache2 installation, with mod_rewrite to test it out with cleanurls enabled.
drupal_get_path called on http://localhost/j-fan.at/user/8 created the right path for me (/j-fan.at/modules/onlinestatus/style.css).
Seems that i can't recreate this false behaviour so easy...
On the other side, i really don't like this line:

drupal_set_html_head('<style type="text/css">@import url('.drupal_get_path('module','onlinestatus').'/style.css);</style>');

I think i should use theme_add_style() instead, this also uses $base_url and my function does not need to import a global var.
Could you try out if this runs smoothly on your configuration:

/**
 * Displays the Onlinestatus of all Messenger on the Userprofile Page
 */
function theme_onlinestatus_profile($user) {
  $items = array();
  theme_add_style(drupal_get_path('module','onlinestatus').'/style.css');
  foreach (onlinestatus_get_messengers(true) as $messenger => $title) {
Anonymous’s picture

StatusFileSize
new863 bytes

my bad.. i forgot the right way to do this..

this is right now..

your not suppose to use theme_add_style. you never wana call a theme function directly.

we want..

drupal_set_html_head(theme('stylesheet_import', base_path() .drupal_get_path('module','onlinestatus').'/style.css'));
xeniac’s picture

I found the Answer for all questions on http://drupal.org/node/60096:

Modules, on the other hand, should not be using theme_add_style because situations can develop in which themers cannot override module-specific CSS. (module CSS should be referenced BEFORE all theme CSS) For this reason, modules should use drupal_set_html_head instead.

Having theme('add_style') and theme('import_style') is to confusing.

I will add your Patch for the next release, but i have to fix the MSN Bug bevor i can commit the changes to CVS.

Anonymous’s picture

cool.

this is something drupal needs documented on a page in the handbook!

thanks xeniac

xeniac’s picture

Status: Active » Fixed

Drupal 4.7 uses
drupal_set_html_head(theme('stylesheet_import', base_path() .drupal_get_path('module','onlinestatus').'/style.css'));

The New DRUPAL-5 Branch makes use of the new drupal_add_css() instead.

This Bug is fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)