AkiShankar
AkiShankar

Reputation: 332

Accessing html.tpl.php variables from page.tpl.php

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.

Upvotes: 1

Views: 393

Answers (2)

ecdani
ecdani

Reputation: 355

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.

Upvotes: 0

jamix
jamix

Reputation: 5628

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.

Upvotes: 1

Related Questions