How do I override the core jquery file with the externally hosted jquery from google

google-api, jquery, php, yii

Solution

There's also another method seen in yii's docs:

For example, we can include jquery.js from Google servers instead of our own server. To do so, we first configure the scriptMap as follows,

$cs=Yii::app()->clientScript;
$cs->scriptMap=array(
 'jquery.js'=>false,
 'jquery.ajaxqueue.js'=>false,
 'jquery.metadata.js'=>false,
 ......
);

By mapping these script files to false, we prevent Yii from generating the code to include these files. Instead, we write the following code in our pages to explicitly include the script files from Google,

<head>
<?php echo CGoogleApi::init(); ?>

<?php echo CHtml::script(
 CGoogleApi::load('jquery','1.3.2') . "\n" .
 CGoogleApi::load('jquery.ajaxqueue.js') . "\n" .
 CGoogleApi::load('jquery.metadata.js')
 );
?>
......
</head>

Problem

In Yii, currently all the dependancies for jquery are loading up a local version of jquery, which i believe is 1.6.*, un-minified. Something along the lines of: ``` <script src="/assets/2343/js/jquery.js"></script> ``` I would like to update the core jquery dependancy to use the jquery 1.7.* from google Basically I would like to include ``` <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"> ``` at the bottom of all my pages whenever jquery is a dependancy.

Original source