how to include scripts via scriptMap

Hi, i try to search and after many tests i can’t get it work, documentation doesn’t provide samples :(

i have:


	echo CGoogleApi::init();

	echo CHtml::script(

		CGoogleApi::load('jquery','1.4.4')/* . "\n" .

		CGoogleApi::load('jquery.ajaxqueue.js') . "\n" .


    ); ?>













google jquery got render but scriptMap scripts doesnt

whats wrong?


You only need to use the scriptMap if you want to tell Yii that scripts are in a different place than they normally would be. For example if you don’t want Yii to use it’s bundled jquery file but supply your own.

If you want to include a script in your site simply use


// As if 1.1.5 (I believe, or 1.1.4?) this is chainable: 




script map is not for renderning files , first you have to attach it like example below ,than you have to map it,



Wait, what?

Just calling the CClientScript::registerScriptFile is enough, no need to set the map in this case.

See the documentation (or my previous post) see what you actually need the scriptMap for.

You didn`t get the point what he wont, he wont to map js files ,he need first to attach it then map it

In that case he should first map it, and then register it.

Otherwise it’s like saying “Register script xyz, oh yeah, and by xyz I mean abc”.

Instead you say "Script xyz should now be known as abc, register script xyz", which will register abc.

Try it if you don’t believe me.

thanks it works :)