Hi there Yii community!
I’ve been working with Yii for a little while now and I’ve developed a simple application for a project. I really like Yii as it has a lot of built in functionality, very easy to set up and Gii is a real time-saver.
I am current working on a new project which is more complicated. It requires jQuery Mobile among other miscellaneous jQuery libraries. Unfortunately I’ve had a less than pleasant experience trying to get Yii to play nicely with jQuery Mobile. It’s been a month+ and I’m still encountering strange bugs.
I’ve tried many recommended solutions such as registering jQuery and jQuery Mobile UI scripts in the config file, as described in many online tutorials, then placing:
In my code. No dice, as I found it was loading my jQuery files first then any refresh would make it include Yii’s jQuery scripts. This would change the look of the page along with it’s behaviour, among introducing other bugs.
I then "fixed" it by using script map:
$cs=Yii::app()->getClientScript(); $cs->scriptMap=array( '*.js'=>false, '*.css'=>false, );
Which (as I understand) tells Yii not to include any of it’s own jQuery or CSS files. This made jQuery Mobile mostly work but many other things broke such as CListView, CHTML links and anything Yii that uses AJAX such as the delete buttons.
I have read some people saying they were successfully using Yii + jQuery mobile but they didn’t go into to many details on how they did it.
Please point me in the right direction! I would like to use jQuery Mobile’s elements but still have access to Yii’s cool elements which are otherwise broken at the moment.