These hooks are meant to transcend template files:
function my_particular_callback() {
  if ( // some condition is meat ) {
    // do stuff
  }
}
add_action('wp_footer', 'my_particular_callback');
A more useful example:
http://scribu.net/wordpress/optimal-script-loading.html