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.
By dx007 on
Hello everyone,
I am under Drupal 7.43 and I wonder how to add multiples JS files in the footer of a page.
For example I have files "file1.js", "file2.js" "file3.js"...... and I want to load them in the footer so I proceed with an template_preprocess_html(&$vars) so the code looks like this:
function theme_preprocess_html(&$variables){
$path = drupal_get_path('theme', 'myTHEME');
$js = array(
$path . 'js/file1.js',
$path . 'js/file2.js',
...
);
drupal_add_js( $js , array(
'scope' => 'footer'
));
}
But it doesn't work. Any ideas please ?
Thank you very much for your help!
Comments
=-=
have you worked through : https://www.drupal.org/node/756722 ?
Yes I've been already there
and I don't see how to figure out my case.
Thanks!