I’m new to this framework and I am still trying to find out if this framework is just right for me. I’ve read the manual (it took some time to understand everything, practiced a bit) but still standing with some unanswered questions.
When I use the CFormModel or widgets, it will automatically include the JQuery script files to the output. I think that’s not always wanted for me. For example, when I will create a new theme which will function as a mobile layout, then I don’t want those unnessecary script files to be included. I got this feeling that I actually don’t have the fully control over these script files and am forced to use JQuery. Now my question, is it possible to take over control and include my own script files by myself? And if I actually want to disable JQuery, is that also possible? Or is this framework just not made for me?
The good news is: Pretty much everything is possible with Yii . In the simplest case it’s just a matter of disabling an option. If there is no option, you can always override some of Yii’s default components with your custom class.
In the case of jQuery: Some of Yii’s components use jQuery for their advanced client features. If you disable jQuery, you need to know what you’re doing and that some widgets might not work anmyore. For example you can use the scriptMap feature of the clientScript component, described here: http://www.yiiframework.com/doc/guide/topics.performance#minimizing-script-files
There was also another discussion these days, with more examples. Just browse the forum.
But how can I use the form model without jquery now? Do I need to rewrite the class or do I need to avoid form models?
I will actually use JQuery on my own website, but want to include it manually per theme. Can I change the views of the widgets per theme, so I can say it may use jquery with this theme and not by the other?
Oh haha I see. Sorry, my fault… I really thought I copied my own view file, but I think I didn’t overwrite or something like that.
But now I just want to know if I can customize widgets to use or not use jquery. I saw this skinning feature, but does this work like the same way as views in theming? Or is it just changing properties and not changing php&html code? I hope I can change the output of the widgets so I can enable or disable jquery per theme.
Should work… but it will break things like the CGridView if you leave it by default… and if you put that in the config it will break Gii too not to forget forms with ajax validtion to true
Mostly it is not really worth the effort if you ask me… (i tried it too)