I was looking on how to use google cdn for serving jquery and came across this code for the main config under components:
'clientScript' => array(
'packages' => array(
'jquery' => array(
'baseUrl' => '//ajax.googleapis.com/ajax/libs/jquery/1.7.1/',
'js' => array('jquery.min.js'),
),
),
),
So that works fine and dandy. I then figured I would do the same with jqueryui, so I added the following
'jquery.ui' => array(
'baseUrl' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/',
'js' => array('jquery-ui.min.js'),
),
It works but I noticed that doing this makes jqueryui load up first before jquery, thus giving me “jquery not defined” errors. I’m including jqueryui in my view files using the following:
Yii::app()->clientScript->registerCoreScript('jquery.ui');
Only way I could get jquery to load up first is to register it as well before jqueryui:
Yii::app()->clientScript->registerCoreScript('jquery');
Yii::app()->clientScript->registerCoreScript('jquery.ui');
Is this correct, or am I missing something?