I noticed Yii encapsulates the GUI interface widgets for JQuery. Sliders, Accordian etc.
I also noticed it encapsulates Dragable, Dropable etc.
What about just standard effects though, like hide, show etc. What is the best way to use these in my Yii application?
$cs->registerScriptFile(Yii::app()->baseUrl . 'file.js', CClientScript::POS_HEAD);
Thanks, I guess does not have the hide, show etc, already programmed in then yeah?
I have been looking at the classes and I have not seen anything programmed into Yii, to do the show, hide functionality of JQuery. Even though I have seen selectable, droppable functionality programmed into Yii, is this true?
you could use fadeIn() fadeOut() and etc methods
Thank you for your help but I am not understanding.
What I am saying is that, Yii has the following JQuery encapsulation classes: -
Has Yii not encapsulated the "fadeIn" / "fadeOut" methods like it has done for many of the other JQuery functions?
There’s no need for that. You have your jquery framework, you include a js containing your own animations and that’s all .
Yii encapsulates some jQuery plugins so that they can be called from PHP without messing with the js code…
fadeIn() and fadeOut() that you asked for are jQuery functions…
Thanks for clearing that up. So the functions I have asked have to be written in JQuery, I understand now.
I still don’t understand what the purpose of Yii::app()->clientScript->registerCoreScript(‘jquery’) is.
I’ve got the following code:
… it doesn’t alert anything. But, if instead of registering the ‘jquery’ package I ‘registerScriptFile’ like the following:
$baseUrl = Yii::app()->baseUrl;
$cs = Yii::app()->getClientScript();
… I would get the wanted alert message.
So, my question is: why to register a ‘jquery’ package if the jQuery file has to be included anyway?
Thanks in advance!
Yii::app()->clientScript->registerCoreScript(‘jquery’) should be enough to include jQuery in your page.
Where to add this code. In views or in main index.php