how to register jquery ui? is it bundled with yii 1.1.1?

how to register jquery ui script? is it bundled with yii 1.1.1?

I did this in a past project



 * ClientScript class file.


class ClientScript extends CClientScript


	public $juiDefaultTheme = 'base';

	public $juiScriptFile = 'jquery-ui.min.js';

	public $juiCssFile = 'jquery.ui.all.css';

	public $juiI18nScriptFile = 'jquery-ui-i18n.js';

	public $juiPathAlias = 'zii.vendors.jui';


	public function registerJuiScripts($cssFile = '', $theme = '', $useI18n = false, $position=ClientScript::POS_END)


		if($cssFile === '')

			$cssFile = $this->juiCssFile;

		if($theme === '')

			$theme = $this->juiDefaultTheme;



		$baseUrl=Yii::app()->getAssetManager()->publish($basePath, true);







		$this->registerScriptFile($scriptUrl.'/'.$this->juiScriptFile, $position);


			$this->registerScriptFile($scriptUrl.'/'.$this->juiI18nScriptFile, $position);



set the class for your coreScript component




to register it, call



Thank you (both) for posting this - very timely, because I just happened to have the same question today.

One thing I am still wondering, though: I am using yii-1.1.1.r1907, and my jQuery UI base theme is


However, I noticed you have jquery.ui.all.css. Did you download that from jQueryUI’s themeroller tool? Or did it come with your version of Yii?

I also ran into this yesterday. Default css in framework/zii CJuiWidget (as of r2049) seemingly has changed from jquery-ui.css to jquery.ui.all.css (the files turned out to be identical). The themes download contains both, framework/zii (r2049) only the latter.


Oh ok, I see. Thanks!

Yes, the name was changed in svn after the last release. You can set the properties in your component config e.g.




    'juiCssFile'=>'css filename',



I just made a small change to the code in the first post so you can also set the path to the jui files as an alias in the component config.

I also changed property $defaultJuiTheme to $juiDefaultTheme for naming consistency.

Nice! Thanks again for this extension. It is very useful to me.

If just need some function from ui…




It seems to have been moved, at least as of 1.1.6, likely before. Now it would be:


Why not simply


You have just to be carefull in including jquery too and the css file.

If you want to do your custom implementation, is better to place a css file for jui widget and manage it with clientscript, in order to be independed to changes in the framework.

Nice zaccaria

Thanks Zaccaria for a very simple solutions

Are you really the best? or is it me only who think so? ;)

The full solution with css

$cs = Yii::app()->clientScript;


$cs->registerCssFile($cs->getCoreScriptUrl(). ‘/jui/css/base/jquery-ui.css’);