Closed (fixed)
Project:
Javascript Aggregator
Version:
5.x-1.3
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
19 Sep 2008 at 03:17 UTC
Updated:
28 Apr 2010 at 00:50 UTC
How can I add external javascript to aggregation? What wrong I may be doing? Is there any other way?
I tried following in template.php with no luck
function _phptemplate_variables($hook, $vars) {
if ($hook == 'page') {
// Add the script.js file
drupal_add_js(path_to_theme() .'/gn.js');
// Reload the scripts variable to include the added file
$vars['scripts'] = drupal_get_js();
if(module_exists('javascript_aggregator') && $vars['scripts']) {
$vars['scripts'] = javascript_aggregator_cache($vars['scripts']);
}
return $vars;
}
return array();
}
Comments
Comment #1
robloachYou might want to take part in the discussion for Drupal 7: #91250: JavaScript Patch #4: External Scripts.
The easiest way with the JavaScript Aggregator to do this would be to stick it in your file system somewhere, and then have your module add it to the page using drupal_add_js(). In Drupal 7, it should have core support.
Comment #2
derjochenmeyer commentedPlease try newest dev #533190: PATCH: allow serving js files from an external file server
Comment #3
derjochenmeyer commented