javascript - Drupal printing .info script groups separately -


i'm defining scripts in theme's .info in 2 groups; loading pre-body , loading post file this:

; scripts in head group load pre-body scripts[head][] = js/cufon.js scripts[head][] = js/font.js  ; scripts in end group load after other html scripts[end][] = js/scripts.js 

is there way print these out separately in view? assumed abble this:

<?php print $scripts['head']; ?> <!-- html --> <?php print $scripts['end']; ?> 

thanks

as far can tell trying not possible can done way.

create [theme]_preprocess_html function in template.php , use drupal_add_js add scripts scope use drupal_get_js retrieve scripts added each scope , $vars:

// set scripts $path = drupal_get_path('theme', 'themename'); // pre-body scripts $options = array('scope'=>'scripts_head','preprocess'=>true); drupal_add_js($path.'/js/cufon.js',$options); drupal_add_js($path.'/js/myfont.font.js',$options); // post-body scripts $options['scope'] = 'header'; drupal_add_js($path.'/js/scripts.js',$options); // pass view $vars["scripts_head"] = drupal_get_js('scripts_head'); $vars["scripts_end"]  = drupal_get_js('header'); 

documentation:
drupal_add_js
drupal_get_js


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -