Skip to main content
Known Participant
August 27, 2013
Question

moble site architecture

  • August 27, 2013
  • 1 reply
  • 1189 views

I have an coldfusion application in production.  I am getting more and more requests for certain functions to be available in a mobile friendly format.  I do not need the entire site to be mobile friendly, just certain parts.  I have researched and determined how to detect the devices and how to redirect mobile users.  2 questions:

1. What is the typical architecture for what I am needing.  For example....currently I have:

webroot/mycfapp

Should I do this?:

webroot/mycfapp/mycfmobileapp  Just add a subfolder?  I am wanting to keep using the original authentication and other processes from mycfapp, but just have a section seperated that includes the mobile features.

What is a light weight accepted way to do this?  I typically develop desktop apps so this is new for me.

2. Where should I store the variable that tells the application which format(desktop or mobile)?  Should I keep that flag or variable in  a session variable or cookie?

It seems the prevailing wisdom to keep the apps seperate and I am all for that.  I just would like to design it with some thought before I begin coding anything.

Thanks

    This topic has been closed for replies.

    1 reply

    Legend
    August 27, 2013

    The most common two ways of doing this are:

    1. Use a separate site or subdirectory like you described -- one for mobile, one for desktop (or "full" site).
    2. Use a MVC framework like FuseBox or Mach II and have separate views for the different formats.

    I lean toward the second option but if your site does not already use a MVC framework, this is a huge undertaking and most likely not an option.

    As to you second question, I would store it in a cookie and allow the user to toggle between the two.

    Known Participant
    August 28, 2013

    Steve,

    Thanks for the info.  I will go with the subdirectory route.  Now my issues have to do with the fact that I will now have 2 login pages, one for desktop and one for mobile.  My authentication begins in OnRequestStart, and includes the login page(rather than using cflocation) if the user is not authenticated or the user/password combo is invalid.  The issue with this is the fact that the images on the login pages will not display correctly because if a mobile user is trying to hit the desktop version of the site, it will include the mobile login page with an incorrect path to the images.  The mobile/login.cfm has path to images "../images/pic.png" and the login.cfm has this path: "images/pic.png".  There are several instances of this occurring and it has to do with using a sub directory.  I am trying to find a way around this issue the correct way with minimal code.  I could have one login page(with both versions of the login page) where it detects the browser rather than having the detection in the application.cfc method.  Any thoughts?

    Legend
    August 28, 2013

    I would probably create two login pages, one in the root (which you probably already have) and another in the mobile subdirectory. Then modify the logic in the onRequestStart to detect which to use. I do it this way because it gets very ugly having big cfif or cfcase blocks with similar functionality but very different html and javascript based on the device.