Jquery Mobile + Yii

Integrating Yii with Jquery mobile (now finally 1.0) would be really interesting in my opinion.

It is perfectly compatible with Jquery and introduces also a very interesting css framework (limited for my taste, yet, but still amazing).

In "marketing" terms that could also be a good move, since people could get even more interested in Yii (that already enjoys its integration with Jquery a lot). I think for example about the possibility to automatically skin forms, manage all touch events (that is a big thing) and make a site fully compatible with mobile devices, or even simple things like organize the page in grids + the extended use of ajax. I still know it superficially, but for what i saw there is something somehow revolutionary in that js framework.

I think many people will start using jquery mobile also for desktop sites, because it helps a lot and offers a new way you can think about a web application (in a much more responsive and "physical" way), even if it is still "only" a 1.0 release.

I know you have many other priorities and that can be a big work, but it is available and it is an idea. :)


It will be a very smart move. I agree: +1 for this feature.

I think it was discused already. jQuery mobile isnt mature enough for production use yet. Check how it behaves on android devices and you’ll see it.

Can you indicate where it is discussed.

They released the first stable version and I have good experience with it. The stable worked well on all the android devices I tried.


Tried to find it but failed. Maybe it was StackOverflow or another website out there.

Greg Molnar

As I remember issues were about animation at iPod and some Android devices w/o much CPU power.

Anyway, tightly integrating jQuery mobile doesn’t sound good to me. Maybe an additional package…

What’s interesting in a possible integration with a php framework or as a separate package, is that jquery mobile deeply modifies the DOM (before being ready), by looking for special tag attributes like data-role=“header” or data-role=“button” where it automatically applies a large set of transformations.

That means that the html generated code needed is actually very simple and clean, since you do not have to apply every single css class and complex html but just general roles to each element.

The improvement is important since you get a mobile compatible css framework and a full set of new events for mobile devices "out from the box" (automatic ajax transitions, etc).

Concerning stability and compatibility i think the last release made big improvements on the past ones, and that will surely continue.

But i understand it cannot be seen as a priority for Yii: integrating them very well could also take a lot of time to Yii developers. And for users it won’t be difficult to integrate those 2 “manually” from scratch. :)

Can you explain a bit more about what would be needed to be done by Yii for the jQuery mobile integration?

For example the "data-role" attribute you mentioned can be set with the htmlOptions…

Yes of course. Nothing that cannot be done manually with Yii as it is today.

An integration would deserve a real discussion on how that could be done… i think there are different ways and levels.

For example (but very stupid): activating jquery mobile from the config file would actually activate it in every html element for every zii widget and generated content (unless you explicitly want to disable it for a particular element/widget), and of course include basic css and js.

Exactly. :)

jQuery mobile is just one of out many frameworks which targets mobile.

Why on Earth should Yii cater for one, and not for the other?

Especially when it’s relatively easy to integrate yourself.

You could even be able to serve a different site for mobile and desktop clients… just another idea.

Yes you are probably right… i admit it. :)

One more thing… the "zii" components are the official extensions for Yii… they are not part of the core… so (IMHO) for the mobile "integration" there would be the need to create a mobile "zii" versions… I think it would be easier than adopting current zii widgets code to work on desktop and mobile simultaneously…

There are other people who really wants Yii to integrate with jQuery Mobile.

Because - as they say: Yii is already integrating jQuery…

IMO, I still can’t see why Yii should… :P

But, maybe if Yii could provide you with some common functionality which makes it easier to integrate jQuery mobile and/or anything else, that would probably be a good alternative?

yes, sure. :)

the point is probably more strategical maybe, than just technical. what is the mobile/tablet/desktop share of the future? i do not know… but it is easy to imagine that we will all be working on touch/small devices very often very soon, if not already. and probably the difference will tend to disappear somehow.

is there any reason to think about it in a php framework? again, i do not know. you surely do much better than me.

i say that because also integrating jquery + ui to yii, today, from scratch, is very simple. but you did it. and i think that was a pretty good idea, even if zii components are and will always be great only for (many) common tasks, as a framework should be, i think.

but is jquery currently part of the core? sorry for my ignorance. if i understand it well, any js integration would be anyway separated from the core…

It’s available in the Yii package, but it’s an optional convenience.

Mainly because the core Yii devs use jQuery.

There’s an extension for extJs, and you can use Prototype, MooTools, and whatever you want.

I remember reading about it and that it’s an issue with the android browser itself and Android OS. It just cannot be fixed by the jQuery Mobile team.

I can confirm this.

I could say the same thing about jquery (which is already part of Yii), jquery ui, htmlpurifier etc. etc. there’s always another choice.

Not really, jquery is widely used by yii.

I strongly agree with this suggestion.

Of course you can manually implement any solution. But that’s not the point. The basic philosophy of Yii Framework is (IMHO) to help and assist developers by giving them a solid foundation on which to continue building your web application. Would that developers could do themselves without Yii Framework? Sure! But this is a main reason why Yii is a real precious treasure for developers.You do not have to bother with an initial, simple but very important features.

On the other hand, only the blind would be overlooked that the Web as we know it is changing. Some even claim that the number of mobile web users will very soon outgrow the number of desktop users. The need for a good solution (in the “Yii way” ;D ) is obvious.

For example, if I want to create web application but also support my mobile, "on the go" users i could create Yii based application, with server side & client side code for desktop and only client side code for mobile users that will implement with server side code. I could even pack it with some kind of mobile multi-platform super mega giga-bigga packager tool like PhoneGap.

Until this point everything is sha-la-la. But what if I want to implement client validation on mobile. User have internet connection, could connect with our server side code and through RESTful API, Json (…) connect with yii code and through it with database. However, how to implement for example this one simple feature? :blink: I know developer could do it manually. But this could also be done manually in desktop version of application, but we very much appreciate the help of Yii. If the forecasts say it will rain more and more mobile users, this will be very popular and requested options. B)

And it does not need to be JQM. I already trust to Yii Team that thay always find finest options on the whole programmer planet. )