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 knalstaaf on
Some developers use a different method each to call scripts for instance.
So there are two ways:
- drupal_add_js("/" . path_to_theme() . '/scripts/myscript.js');
- drupal_add_js($GLOBALS['theme_path'].'/scripts/myscript.js')
We were told the second one ($GLOBALS) is rather unpredictable. Is that right?
What is the best practice to call these kind of scripts anyway?