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.
After a bit more googling & looking around, I found the answer:
in the config, under 'components'
'clientScript'=>array(
'packages'=>array(
'jquery'=>array(
'baseUrl'=>'http://ajax.googleapis.com/ajax/libs/jquery/',
'js'=>array('1.7.2/jquery.min.js'),
)
),
),
),
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With