Sencha Touch & ExtJS profiles for desktop and mobile in one web project/vhost?

流过昼夜 提交于 2019-12-21 06:21:28

问题


I'm creating a web application with desktop and mobile versions using ExtJS and Sencha Touch.

ExtJS 4 and Sencha Touch 2 use an MVC approach, and Sencha Touch 2 incorporates "profiles" for different devices (iPhone, tablet, etc.).

ExtJs 4, however, has no notion of profiles. Is it realistically feasible to for dependencies for desktop, iPhone, and iPad versions of the app to live under one vhost, in the same app directory hierarchy?

Or, is it generally more acceptable to use different vhosts for desktop (app.com) and mobile sites (m.app.com) when dealing with the Sencha frameworks?


回答1:


I recently had the same situation. I have a single c# controller that returns the desktop or mobile index.html based on useragent. It all appears as http://www.mydomain.tld and runs under a single IIS site. Since all the calls are AJAX to REST, they share the same server code. It's only the view that changes. The same could be done with any other server and language.

My structure is:

Root
 |_desktop
 |   |_app
 |   |_lib
 |   |_resources
 |_mobile
 |   |_app
 |   |_lib
 |   |_resources
 |_shared
     |_localization.js (generic JS objects)
     |_proto.js (my generic prototype functions)



回答2:


Right now, no it's not realistic to have everything in the same project.

Ext JS and Touch, despite having similar APIs, do not have the same API. Therefore you likely cannot share any code between the frameworks (currently Ext JS 4.1.3 and Touch 2.1.0 are the latest releases).

Therefore, since you're ultimately writing separate apps, I'd keep them totally separate code bases.

As for your domain/vhost question... you could configure your server either way, I don't know if that matters so much in my opinion.



来源:https://stackoverflow.com/questions/14286522/sencha-touch-extjs-profiles-for-desktop-and-mobile-in-one-web-project-vhost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!