1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    22
    Vote Rating
    0
    slmckenzie is on a distinguished road

      0  

    Default Combining Both an ExtJS and Sencha Touch App into the same subdomain?

    Combining Both an ExtJS and Sencha Touch App into the same subdomain?


    Hey all! I did some digging, and couldn't find a simple answer for this. I'm hoping I just overlooked it somewhere, and that someone else would be able to help me out and point me in the right direction, so I don't get myself backed into a corner trying to make this work!

    I currently have two applications that both serve the same backend database. One is a Sencha Touch mobile app (for iPad, primarily), and the other is an ExtJS desktop app, which provides the same features as the mobile app, but just in a desktop / mouse / keyboard friendly environment. Both provide the same functionality, and read / write from the same database. But for simplicity, I stuck both into separate subdomains, and pointed my user at the correct domain for their environment needs. (ex., desktop.mydomain.com, and mobile.mydomain.com).

    So far, this has worked well, until I started needing to duplicate the backend AJAX / JSON PHP files to read / write data from the database. I don't want to have to have duplicate copies of the PHP files in each subdomain so that each app can communicate with the database. I'd prefer to consolidate everything down into a single subdomain, and make it so that the user can either simply point to the domain and be routed to the correct app, or can instead access the right app by a subfolder (ex., app.mydomain.com/mobile, or app.mydomain.com/desktop).

    My ExtJS application file system is as follows:

    Code:
    desktop.mydomain.com
    - app (contains all models, views, controllers, etc.)
    - app.js
    - data (contains all .php files for reading / writing from the database)
    - extjs (contains the framework)
    - index.html
    My Sencha Touch application file system is as follows:

    Code:
    - app (contains all models, views, etc.)
    - app.js
    - app.json
    - bootstrap.js
    - bootstrap.json
    - build.xml
    - index.html
    - php (contains all the .php files for reading / writing to the database)
    - resources (additional images, javascript, etc. to include in the builds)
    - touch (contains the framework)
    What I'd like to maybe be able to do is something that would look like:

    Code:
    - desktopapp
    -- (here would be everything from my desktop app above)
    - mobileapp
    -- (here would be everything from my mobile app above)
    - index.html (would read the useragent and redirect to the right folder accordingly)
    Am I going about doing this right? Or is there something wrong if I decide to go that route? I just want to make sure that I can put the apps into subdirectories, and that they don't need to be at the root level of the subdomain. I want to make sure I don't try to combine them together and do a bunch of rearranging, only to find out that I screwed something up along the way and completely break everything!!

    Thanks for your help!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Vote Rating
    750
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You can have multiple app using same subdomain it's just how you setup the server side to handle it. I use a PHP framework and I use it as a proxy to stream the files through. So I detect if the user agent is mobile or other. If mobile then I load the index.html from the mobile app, if other then I go to the desktop app. Of course there are other files than index.html that you would have to do this for and usually setup a .htacess (or the like for nginx) so that it sends all requests for a directory to a PHP file but sends the file as an argument.

    This is all complicated especially to talk about over a thread but it is possible to do.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    285
    Vote Rating
    48
    Ekambos is a jewel in the rough Ekambos is a jewel in the rough Ekambos is a jewel in the rough

      0  

    Default


    We solved this by detecting which client the user is using and dynamically injecting the Ext JS of Sencha Touch resources in the main html page. That way our app can be served from the same page and we can even share code between Ext JS and Sencha Touch.
    We done this is Java but I m sure the same can be done with pure JS.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Vote Rating
    750
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Quote Originally Posted by Ekambos View Post
    We solved this by detecting which client the user is using and dynamically injecting the Ext JS of Sencha Touch resources in the main html page. That way our app can be served from the same page and we can even share code between Ext JS and Sencha Touch.
    We done this is Java but I m sure the same can be done with pure JS.
    Wouldn't that take some time for index.html to load and to inject resources after the fact? Especially since Sencha Touch is going to turn around and do the same thing?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    285
    Vote Rating
    48
    Ekambos is a jewel in the rough Ekambos is a jewel in the rough Ekambos is a jewel in the rough

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Wouldn't that take some time for index.html to load and to inject resources after the fact? Especially since Sencha Touch is going to turn around and do the same thing?
    Not at all.
    We are pretty happy with the performane.

    What I mean is that we inject Ext JS or Sencha Touch resources based on the client machine.
    We have a script that will detect the client features and based on those informations inject the required resources.
    The injection is done only once.

    This save us from maintaining 2 urls and 2 differents apps for desktop and mobile.
    We have to code two differents UIs (makes sence because mobile and desktop interactions are different anyway) but we can share most of the business code between both clients.

    I will share a blog entry about that soon.

  6. #6
    Sencha User
    Join Date
    Nov 2012
    Posts
    22
    Vote Rating
    0
    slmckenzie is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    You can have multiple app using same subdomain it's just how you setup the server side to handle it. I use a PHP framework and I use it as a proxy to stream the files through. So I detect if the user agent is mobile or other. If mobile then I load the index.html from the mobile app, if other then I go to the desktop app. Of course there are other files than index.html that you would have to do this for and usually setup a .htacess (or the like for nginx) so that it sends all requests for a directory to a PHP file but sends the file as an argument.

    This is all complicated especially to talk about over a thread but it is possible to do.
    Hmm, you're right, that does sound quite complicated!

    I'm surprised that there's nothing currently in place already to support having both the desktop and mobile versions running side-by-side under the same domain. I wouldn't think that would be a very uncommon request. I might just have to try to see if I can do something like having http://app.mydomain.com/mobile or http://app.mydomain.com/desktop, and having both simply access the php data operations in a /php directory.

  7. #7
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    285
    Vote Rating
    48
    Ekambos is a jewel in the rough Ekambos is a jewel in the rough Ekambos is a jewel in the rough

      0  

    Default


    Quote Originally Posted by slmckenzie View Post
    Hmm, you're right, that does sound quite complicated!

    I'm surprised that there's nothing currently in place already to support having both the desktop and mobile versions running side-by-side under the same domain. I wouldn't think that would be a very uncommon request. I might just have to try to see if I can do something like having http://app.mydomain.com/mobile or http://app.mydomain.com/desktop, and having both simply access the php data operations in a /php directory.
    Well I just gave you the solution above

  8. #8
    Sencha User
    Join Date
    Nov 2012
    Posts
    22
    Vote Rating
    0
    slmckenzie is on a distinguished road

      0  

    Default


    Quote Originally Posted by Ekambos View Post
    Well I just gave you the solution above
    Right, and I appreciate it!

    What I meant though was that I'm surprised that there's no built-in capabilities into the Sencha Touch / ExtJS frameworks that allows for something like that, without having to resort to "hacks" to inject resources dependent upon the UserAgent or other external triggers to do so.

    I'll look forward to reading your blog post regarding this!

  9. #9
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    285
    Vote Rating
    48
    Ekambos is a jewel in the rough Ekambos is a jewel in the rough Ekambos is a jewel in the rough

      1  

    Default


    Quote Originally Posted by slmckenzie View Post
    Right, and I appreciate it!

    What I meant though was that I'm surprised that there's no built-in capabilities into the Sencha Touch / ExtJS frameworks that allows for something like that, without having to resort to "hacks" to inject resources dependent upon the UserAgent or other external triggers to do so.
    Now that Sencha is trying to unify Ext JS and Sencha Touch (at least some part) I think they will have some kind of solution regarding using both frameworks in the same app.

    Quote Originally Posted by slmckenzie View Post
    Right, and I appreciate it!
    I'll look forward to reading your blog post regarding this!
    Should come out soon.
    The tutorial will use GWT and the Java language though.
    We do Ext JS and Sencha Touch not in JavaScript.

    But Since GWT generate JS I guess this can be done in pure JS too.

  10. #10
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    285
    Vote Rating
    48
    Ekambos is a jewel in the rough Ekambos is a jewel in the rough Ekambos is a jewel in the rough

      0  

    Default


    In the meantime you can see it in action here :
    http://eemi2010.github.io/ext4j/explorer/index.html

    Just visit the page with a desktop browser and a mobile device.

    Or explicitely :

    Desktop : http://eemi2010.github.io/ext4j/explorer/index.html
    Phone : http://eemi2010.github.io/ext4j/expl...rmfactor=phone
    Tablet : http://eemi2010.github.io/ext4j/expl...mfactor=tablet

    Cheer

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar