Hi,

An excellent module. Have tested it and works well on my sandbox. The problem comes when I try to use it on one of my other sites, I do not see any icons at all, either in the admin panel or on the nodes themselves. The code is there in the HTML, but the CSS is not linked to.

It could be a module conflict, however, I think it is to do with the fact I am using the private file system. It does create the css file in the correct place, but when viewing a node, the CSS include line is produced as:

<link type="text/css" rel="stylesheet" media="all" href="/../files/mysite/css/sexybookmarks.css?1" />

If I click on it it doesn't take me to the CSS file, so this is not linking to the CSS file.

Can you confirm this is a bug?

Regards,
Nick

Comments

nickbits’s picture

Hi,

I can confirm that this is a private file system issue. I have got two clen installs of drupal with only SexyBookmarks installed. On system using private and one using public. The public works but the private doesn't. It is only the CSS that fails to link.

I did have a crack at fixing this but just can't seem to get it. Here is what I ahve done (do point out the obvious mistake I have made!):

1. Changed lin 201 from:

drupal_add_css($file);

to

_sexybookmarks_add_css_fs($file);

2. Knowing that ctools has the same problem, I have borrowed code from there and inserted. The code is:

/**
 * Add a sexybookmarks CSS file to the page.
 *
 * Because drupal_add_css() does not handle files that it cannot stat, it
 * can't add files that are stored in a private file system. This will
 * will check to see if we're using the private file system and use
 * drupal_set_html_head() instead if that is the case.
 *
 * Sadly that will preclude aggregation of any sort, but there doesn't seem to
 * be any ways around that. Also it will screw with stylesheet order. Again,
 * sorry.
 */
function _sexybookmarks_add_css_fs($filename = NULL, $type = 'module', $media = 'all', $preprocess = TRUE) {
  switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
    case FILE_DOWNLOADS_PUBLIC:
      drupal_add_css($filename, $type, $media, $preprocess);
      break;
    case FILE_DOWNLOADS_PRIVATE:
      $url = file_create_url($filename);
      $output = '<link type="text/css" rel="stylesheet" media="' . $media . '" href="' . $url . '" />'."\n";
      drupal_set_html_head($output);
  }
}

This still doesn't work, it just outputs:

<link type="text/css" rel="stylesheet" media="all" href="/../files/mysite/css/sexybookmarks.css?S" />

I did try hardwiring the link ($output variable) above to one of the following:

<link type="text/css" rel="stylesheet" media="all" href="/system/files/css/sexybookmarks.css" />
<link type="text/css" rel="stylesheet" media="all" href="http://sandbox.dev/system/files/css/sexybookmarks.css" />

Neither worked. I have never had to add CSS from the private file space before so I may be going about it wrong. Any pointers?

Cheers,
Nick

deciphered’s picture

Version: 6.x-1.0 » 6.x-1.1
Status: Active » Fixed

Fix committed to SexyBookmarks 6.x-1.1.

Cheers,
Deciphered.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.