How to embed javascript into content region I am trying to embed javascript into the content page of my page. I decided to use php filter and the following is my code:

&lt;?php
$scripty = "http://blah.com/plugins/embedvanilla/remote.js";
drupal_add_js($scripty, array(
'type' =&gt; 'external',
'scope' =&gt; 'content',
'group' =&gt; JS_LIBRARY,
'every_page' =&gt; FALSE,
'weight' =&gt; -1,
)
);
?&gt;


The script shows on this page if scope is not set (which means it defaults to header).

How can I get it to display in the content region?
Never use php filter, it's one of the worst inventions in Drupal.

You can create a region in your info theme.  Then, use the preprocess hook like that:

function hook_preprocess_region(&amp;$vars) {
  // Region names of (header|footer) collide with drupal_add_js()'s
  // (header|footer) labels.
  $scope_theme = 'your_region';
  if (!empty($scope_theme) &amp;&amp; $scope_theme != 'footer' &amp;&amp; $scope_theme != 'header'
    &amp;&amp; $vars['region'] == $scope_theme) {

    // Inject javascript into page.
    $javascript = drupal_get_js($vars['region']);
    $vars['content'] = $javascript . $vars['content'];
  }

}


And finally, fire your drupal_add_js using the region you defined wherever you prefer... But never in php filter