In the page.tpl.php template file, I have the appropriate print $scripts; call in the HEAD tag. I tried using the example code (below) at the beginning of the file, but it doesn't work, even after clearing the cache.

<?php
  echo '<div class="countdown">10 seconds!</div>';
  jquery_countdown_add(".countdown", array("until" => 10, "onExpiry" => "finished"));
  drupal_add_js("function finished() { alert('You are done!'); }", 'inline');
?>

I looked into the Drupal.settings code in the header, and I do not see the typical jquery_countdown definitions.

Comments

chadhester’s picture

Scratched my own itch. It appears that the best method (in page.tpl.php) is with the jquery_countdown_add() function. But after that, the $scripts variable still isn't updated, so before I call that in the HEAD, I update it with:
$scripts = drupal_get_js();

Because of this, I don't think that using jquery_countdown_add() function after the $scripts variable has been called is a good idea.

chadhester’s picture

Status: Active » Closed (works as designed)

closing this, since there's a legit workaround