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 drew777 on
Hello,
I am trying to use drupal_add_js(base_path() . path_to_theme()."/myscript.js") in the top of my node.tpl.php file for a theme I am developing for Drupal 4.7. No matter what I do I can't make it include any javascript files using this function. The documentation for this function says it will include the .js file and also include the misc/drupal.js file, which I need to make this theme work.
What am I doing wrong?
Comments
Figured it out
I get it now. You need to create a template.php file and put the function in there. Solved my own problem.
details for non-coder/newbie coder...
Could you post exactly what code you put in the template.php file? This sounds like something I could pull off if I could learn from you what needs to go with the function. My theme already has a template.php file, so I'm wondering if you need any extra php end or close symbols or anything else?
Thanks