CJuiWidget: default theme / themeUrl?


I’d like to be able to setup a default value for the CJuiWidget widget without editing the source of the widget itself or extending it.

What I’d like to achieve is to avoid to set the themeUrl settings each time I load a widget that it is based on CJuiWidget for example CJuiDialog / CJuiDatePicker and so on…

Do you know if it is possible / how do you manage this? Or do you specify the theme / themeUrl param each time you load a widget based on CJuiWidget?





for now the best solution I’ve found is to pass ‘cssFile’=>false to each widget and to include by hand my css… but in this case if I want to use a custom theme for a widget I’ll end having two css files instead of one (the one loaded by hand will then be useless as it would be overridden by the one loaded from the widget) ::)

I 've just searched and found how to set the themeUrl for CJuidialog. I suppose it’s the same for the other JUI.

I’ve come to think now that it’s a very powerfull way to set a custom theme.

I’ve just implemented it on the farm cjuidialog_ajaxbutton under create Person. so you can have a look before implementing yourself if this answers your question.

The widget call that I make in the farm is :




			'title'=>Yii::t('job','Create Job'),







		'theme'=>'custom-theme',	//File name must be jquery-ui.css located in 'themeUrl'/'theme'

                ) );

My custom-theme was generated from the powerful JQueryUI theme Roller . Make one, download it and put it in place. Mine was "jquery-ui-1.8.1.custom.css" and I had to rename it specially to "jquery-ui.css" which seems to be expected by zii.


thanks for your answers, but what I meant was I’d like to find a way to avoid to specify each time you use a widget the themeUrl / theme parameters:



I’d like to be able to specify this just once, somewhere, and then don’t write this two lines of code (or just one if you name your theme “base”) each time I use a CJuiWidget… ::)





thanks for sharing your farm test project; did you had a look to the yii playground project? (see my signature) ;)


just found a similar topic by searching for a different keyword…

but as I stated I would avoid to extend each widget based on CJuiWidget just for this… :blink:

Would be nice to be able to set it up as a per-theme setting or a config setting ::) If you confirm me that this is not possible I would ask to move this topic on feature requests or I’d open a new one ;)

please let me know, thanks.



This are the steps that I did for change the default theme…

  1. I went to the official Jquery website, and I downloaded the "redmond" css file…

  2. I created a file named "jquery-ui.css" under the directory [BASE_DIRECTORY]/themes/[THEME_NAME]/css/redmond

  3. I added the css code that I downloaded from the Jquery website to the jquery-ui.css

  4. This is the code of my CJuiButton widget:



     "caption"=>'Eliminar Plan',
     'onclick'=>'js:function(){alert("clicked"); this.blur(); return false;}',

[b] ‘themeUrl’=>Yii::app()->theme->baseUrl.’/css’,

            'theme'=>'redmond',        [/b]