dimvic7
(Dimitris Vic)
December 4, 2011, 6:17pm
1
I looked around quite a lot and I can see that the method suggested for not loading yii’s embedded jquery version is by using
<?php $cs=Yii::app()->clientScript;
$cs->scriptMap=array(
'jquery.js'=>false,
); ?>
or equally by adding to config
'clientScript'=>array(
'class' => 'CClientScript',
'scriptMap' => array(
'jquery.js'=>false,
),
'coreScriptPosition' => CClientScript::POS_END,
),
still, i want to have my included jquery version named jquery.js which scriptMap does not allow
can i dodge that restriction?
is there an alternative way to disable yii’s auto-load of jquery?
1 Like
gusnips
(Gustavo)
December 4, 2011, 6:19pm
2
dimvic7
(Dimitris Vic)
December 4, 2011, 6:27pm
3
this helps a lot
if i name my customized version’s package “jquery” it overrides yii’s
but i would like to be able to register something like
[jquery-1-6-4-jquery] => Array
(
[basePath] => ext.repo.assets
[js] => Array
(
[0] => jquery/1.6.4/js/jquery.js
)
)
I am making an extension to be used as a script repository which generates and registers packages
for exampe $repo->load(‘jquery:1.6.4:jquery,scriptb’) registers package
[jquery-1-6-4-jquery-scriptb] => Array
(
[basePath] => ext.repo.assets
[js] => Array
(
[0] => jquery/1.6.4/js/jquery.js
[1] => jquery/1.6.4/js/scriptb.js
)
)
so I’d like to include version and included files’ names in package name for various reasons and thus would like this functionality
gusnips
(Gustavo)
December 4, 2011, 6:44pm
4
do something like this
add your packages
'clientScript'=>array(
'class' => 'CClientScript',
'coreScriptPosition' => CClientScript::POS_END,
'corePackages' => array(
'jquery'=>array(
'baseUrl'=>null,//unset the defaults
'js'=>null,
'depends'=>array('jquery-1.6.4'),//tell the component that it depends your package
),
),
'packages'=>array(//register your packages
'jquery-1.6.4'=>array(
'baseUrl'=>'/js/jquery/1.6.4/'
'js'=>array('jquery.js'),
),
'jquery-1.7'=>array(
'baseUrl'=>'/js/jquery/1.7/'
'js'=>array('jquery.js'),
),
),
),
see more about packages and corePackages
to register your our package
Yii::app()->clientScript->registerPackage('jquery-1.7');
dimvic7
(Dimitris Vic)
December 4, 2011, 6:50pm
5
something like that could help, but for the shake of simplicity I will probably move towards not banning jquery.js in scriptmap and naming the package "jquery" to override the default
it would just be sweat if I could use a different package name and still have jquery.js available as a name