Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
#4 | fivestar_css_js_add.patch | 1.48 KB | quicksketch |
Comments
Comment #1
quicksketchIf 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.
Comment #2
buddaI'm using the module provided 'Fivestar: Rate this node' block.
Amend the fivestar.module with:
However the problem of the fivestar javascript not loading continued.
Aggressive page caching is also enabled.
Comment #3
moeed CreditAttribution: moeed commentedSame 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?
Comment #4
quicksketchWell 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.