[solved] forbid loading of yii's jquery.js & load own jquery.js (same name)?

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

take a look here

http://www.yiiframework.com/forum/index.php?/topic/25499-how-to-load-jquery-17-instead-of-default-161/page__view__findpost__p__122936

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

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');



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