Broken Link to style.css
Steve McKenzie - July 6, 2006 - 17:37
| Project: | Onlinestatus Indicator |
| Version: | HEAD |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Steve McKenzie |
| Status: | closed |
Description
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.
| Attachment | Size |
|---|---|
| broken_style_css_link.patch | 984 bytes |

#1
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:
<?phpdrupal_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:
<?php/**
* 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) {
?>
#2
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..
<?phpdrupal_set_html_head(theme('stylesheet_import', base_path() .drupal_get_path('module','onlinestatus').'/style.css'));
?>
#3
I found the Answer for all questions on http://drupal.org/node/60096:
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.
#4
cool.
this is something drupal needs documented on a page in the handbook!
thanks xeniac
#5
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.
#6