I try to load JavaScript with drupal_add_js()
, but it's not easy, and after fixing the loading of external JavaScript, I faced off a loading order issue: My external JavaScript is loaded after my local ones, and I would like the opposite behavior. Is it possible with Drupal 6?
Additional problem but optional: Is it possible to load these in footer instead of the header?
This is my code.
function d6_ce_susy2_preprocess_page(&$vars){
//http://www.zites.net/en/load-external-javascript-files-drupal-6/
$external_js1 = 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js';
drupal_add_js('document.write(unescape("%3Cscript src=\''. $external_js1 .'\' type=\'text/javascript\'%3E%3C/script%3E"));', 'inline');
$external_js2 = 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.3.min.js';
drupal_add_js('document.write(unescape("%3Cscript src=\''. $external_js2 .'\' type=\'text/javascript\'%3E%3C/script%3E"));', 'inline','header');
$external_js3 = 'http://cdnjs.cloudflare.com/ajax/libs/masonry/3.3.2/masonry.pkgd.min.js';
drupal_add_js('document.write(unescape("%3Cscript src=\''. $external_js3 .'\' type=\'text/javascript\'%3E%3C/script%3E"));', 'inline');
drupal_add_js(drupal_get_path('theme', 'd6_ce_susy2') . '/js/jquery_init.js','theme');
drupal_add_js(drupal_get_path('theme', 'd6_ce_susy2') . '/js/js_jquery_new.js','theme');
drupal_add_js(drupal_get_path('theme', 'd6_ce_susy2') . '/js/jquery_exit.js','theme');
drupal_add_js(drupal_get_path('theme', 'd6_ce_susy2') . '/js/js_jquery_defaut.js','theme');
}