Reputation: 415
I am stuck. Please let me know how does Yii framework include script files into the template? I searched everywhere but I cannot see any code doing this. If it is a automatic feature of Yii framework how can I change or remove it?
Upvotes: 2
Views: 245
Reputation: 14459
Yii has a concept called assets manager
which yii defines it as:
CAssetManager is a Web application component that manages private files (called assets) and makes them accessible by Web clients.
If you want to stop loading yii's default js files (such as jquery) you can do it like below:
Yii::app()->clientScript->scriptMap=array(
'jquery.js'=>false,
'jquery.ui.js' => false,
);
The above line says that: Yii, please do not load jquery.js
and jquery.ui.js
scripts into my application.
It might also be noted that these can also be configured in main.php
config file. In cases that you need to configure these scripts in main.php
config file, you can add the following lines into the components array in main.php
file:
'clientScript'=>array(
'packages'=>array(
'jquery'=>array(
'baseUrl'=>'//your url',
'js'=>array('jquery.min.js'),
'coreScriptPosition'=>CClientScript::POS_HEAD //loads it on HEAD
),
),
),
Upvotes: 2