1
votes

Greeting, I am stuck with accessing $scripts variable of html.tpl.php in page.tpl.php, how to access the variable?

I am using Drupal 7

Please Help. Thanks in Advance.

2
What do you need to do?! - Muhammad Reda
My page calls an external js and I have to unset it. I am not sure about what the correct method would be. I thought of unsetting it at template.php. - AkiShankar
Do you need to unset a drupal added js file? What do you mean by page calls an external js? - Muhammad Reda
Drupal relies on some javascript to work properly. If you manage to unset some script your site might not be correctly accessed. You may want to describe in some detail what exactly are you trying to do. - pamatt

2 Answers

1
votes

In order to alter the page's scripts, take a look at implementing hook_js_alter() in a custom module. That will allow you to perform the necessary alterations without messing with the rendered output. Further info here.

0
votes

You must send explicity the variable you want to the template you want, template variables are template specific, there's no inheritance or another clean way.

The clean way is send what you need to specific template or implement a hook if it exists and does what you want.

Finally, in this case, I think you have to decide which files are loaded when hook_js_alter is called as suggested jamix.