I'm getting a blank base_path which is causing the path to the CSS to be //path rather than /path

"//modules/_contrib/og_teampage/og_teampage.css";</style><style type="text/css" media="all">@import

I don't think base_path is needed any more? so I've changed my version to

  drupal_add_css(drupal_get_path('module', 'og_teampage').'/og_teampage.css');

Comments

ejort’s picture

This issue is also present on my install... I haven't checked the fix though, I might get a chance later tonight.

MartinSfromB’s picture

Assigned: Unassigned » MartinSfromB
Status: Active » Fixed

drupal_add_css needs no base_path. Thank you!
Added base_path() while fixing #155196. Images seem to need base_path() but drupal_add_css() doesn't. Am I right?

csc4’s picture

Seems so
http://api.drupal.org/api/5/function/drupal_add_css says
$path (optional) The path to the CSS file relative to the base_path(), e.g., /modules/devel/devel.css

and http://api.drupal.org/api/5/function/drupal_get_path says
Returns the path to a system item (module, theme, etc.) - though in my PHP blocks I usually just add a slash at the front to keep the URL internal.

I noticed the other day that the user.module uses
$picture = file_create_url($account->picture);
http://api.drupal.org/api/5/function/file_create_url so I was wondering if I should be switching to that type of syntax especially with the base_url changes between 4.7 and 5 and 6 and 7 round the corner!

Anonymous’s picture

Status: Fixed » Closed (fixed)