I think the MVC structure of Yii, and the way widgets like CGridView work should make Ember an attractive proposition for Ajax-based applications (the widget renderers should be able to translate their logic into Handlebars templates fairly easily, and the Html5 history API routing integration could stick quite nicely with Yii’s path routing model.
Again, I have just thrown this out there for discussion, without actually doing all necessary research as to whether it would be technically feasible, so please let me have your thoughts.
No particular reason - all are valid - I did say “eg”. It’s just that Ember is the only one I have any real experience with, and (I may be wrong here - like I say, I don’t really know them) it seems to me that Backbone doesn’t include live templates, and Angular makes great use of element markup, while I quite like the idea in Ember of keeping data out of the Html (that being said - this is Html5 now, with support for data in tags…).
As for Yii not interfering with the front-end, I do take the point, but Yii already does interfere with the front-end through things like the (very useful) widgets CListView/CGridView, which produce a similar effect (including Html5 history API routing to a limited extent) but without the structure and extensibility of things like Ember - so why not integrate that instead of the custom JS we use currently. And since these widgets are not actually part of the core anyway, we can say that it’s not interfering
While Ember may be over-engineered, the example you gave includes a fairly hefty amount of backbone plugins, that probably make it just as engineered as Ember.
Anyway, like I said - just throwing this out for discussion…
Spitting out JSON is not too hard, but what I like about CGridView is the way that (mostly) it fails gracefully in case of JS problems - eg the sorting link on a column will work as a hard link if the click event is not triggered properly.
I’m probably not thinking about this deeply enough (my head hurts from work at the moment), but a Yii controller whose default view could implement an Html page with an Ember controller, generating routes that follow the same convention, using the history API so that the url functions as a proper route whatever the circumstances (js or no) sounds like something good to me…
I did (and still do) find Ember a steep learning curve, all the more so since they have made major breaking changes, so that most of the examples around are obsolete, but I think their philosophy is the same as the Ruby-on-Rails convention over configuration, and if I recall correctly, Yii is inspired from R-o-R.
I wouldn’t expect that, but what I would like is for a front-end generated history url to work appropriately on a page refresh when js is disabled (so if I have a front-end page generated at mysite.com/posts, which lets me view a particular post, while changing the history url to mysite.com/posts/76 to represent its state, if I were to refresh that url without js enabled - or copy and paste the url into a browser without js enabled, then the back-end should generate the same representation as was used by the front-end controller with js enabled) - that is what would be advantageous about back-end/front-end integration.