Reputation: 406
I have a codeigniter application for desktop can it be converted to a mobile app when accessed from a mobile using the same code?
Upvotes: 2
Views: 4338
Reputation: 22862
You have two options, create a responsive design or create one desktop design and a mobile design based on the user agent.
If your design is easy to adapt for both worlds (desktop and mobile) with a little tweaking and a responsive design should be enough to do the trick. But before you choose this way remember that you have plenty of mobile devices with many screen resolutions.
I advise you to read this slideshow about the mobile web: http://www.slideshare.net/bryanrieger/rethinking-the-mobile-web-by-yiibu
And just for information the types of mobile devices we have on the market. http://jquerymobile.com/gbs/
To help you out with responsive design you can use some of the frameworks available on the internet:
Twitter bootstrap : http://twitter.github.com/bootstrap/index.html
Foundation 3: http://foundation.zurb.com/
Skeleton: http://www.getskeleton.com/
YAML 4: http://www.yaml.de/
You can see more frameworks here http://www.awwwards.com/what-are-frameworks-22-best-responsive-css-frameworks-for-web-design.html
In case your desktop layout doesn't fit as a proper mobile layout you can rely on the user agent, although he is not 100% accurate, and build two different layouts. On the desktop side you can use some of the responsive frameworks mentioned before, for the mobile side you can use:
jQuery Mobile: http://jquerymobile.com/
UI ON TARGET: http://www.rikulo.org/
The best is a mix of the two worlds, a responsive design for small and large screens for users on a desktop and a proper design for mobile users.
Upvotes: 3
Reputation: 3716
the different between two is in the template or view part of application . basically you have to identify visitor device and if it is a mobile show him the mobile view that you have prepared .
you can create great responsive mobile template using jquery mobile .
Upvotes: 2
Reputation: 9476
Yes, I've done exactly this in the past.
What I did is I used the user agent class to detect whether the user agent was a desktop or mobile client, and used that to set a flag in the sessions. Based on that, I served different views depending on the value of that flag. This approach has the advantage that the URLs remain the same regardless of which interface you're using.
I would recommend adding a way to manually override this, though, since detecting the user agent is never going to be 100% accurate.
Upvotes: 2