If the fivestar block is cached using the built in D6 caching, then the javascript fails to load.
I understand why this is, but is there any work around for it?

CommentFileSizeAuthor
#4 fivestar_css_js_add.patch1.48 KBquicksketch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

If you're doing this in a hook_block() implementation, you can return $block[$delta]['cache'] = FALSE when listing the blocks. If this is a block added through the admin interface, a quick fix is to use the PHP Input Format for that block, since any blocks using a non-cachable input format will not be cached either.

budda’s picture

I'm using the module provided 'Fivestar: Rate this node' block.

Amend the fivestar.module with:

  switch ($op) {
    case 'list':
      $blocks[0]['info'] = t('Fivestar: Rate this node');
      $blocks[0]['cache'] = false;
      return $blocks;

However the problem of the fivestar javascript not loading continued.

Aggressive page caching is also enabled.

moeed’s picture

Version: 6.x-1.x-dev » 5.x-1.13

Same problem here. I'm running a D5 installation which is using 5.x-1.13 version of the module. When I enable the blockcached version of the block, the stars don't show up. But if I put both the cached and the uncached versions together, the stars appear on both of them. Any workaround which doesn't endanger performance for the site?

quicksketch’s picture

Status: Active » Fixed
FileSize
1.48 KB

Well I've struggled for a long time to not introduce this solution, but it seems inevitable that it be added until we get better dynamic loading of CSS/JS in Drupal core. This patch adds the Fiverstar CSS/JS files on every page of the site, which is unfortunate for sites that use Fivestar on only a few pages, but beneficial to sites that use Fivestar on most of their pages. It also solves problems with the Views administration screen, or modules that load in Fivestar through AJAX when a Fivestar widget is not on the original page.

Status: Fixed » Closed (fixed)

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