Welcome Guest, Not a member yet? Register   Sign In
Loading different views when on a mobile browser
#1

[eluser]Prullenbak[/eluser]
Hi all,

I'm kinda new to codeigniter, and totally new to the forums, so bear with me Smile

I'm building a site which need to show different views to a user when he is on a mobile browser. Now, I've googled and searched here on the forum, but I can't seem to find an answer.

What I could do, is add a check for the user agent in every function, and load the appropriate views. However, this will clutter the code in my controllers, because I would need to do this whole if else stuff every time.

There was another solution I've found, which dealt with making some changes in the index, and copying that to a subfolder. I saw this meant the mobile version of the pages would have another url though. But I need the desktop and mobile version of every version to have exactly the same URL.

So, what I would like very, very much, is to be able to let CI do this automatically for every view that's loaded, in the entire application:
If the user is on a mobile browser, always look for view files in the views/mobile/ folder, and if he's not on mobile, always look in the views/default/ folder.

Is this possible?

Thanks a lot in advance,

Prullenbak

By the way: Some other similar questions to this one, where getting answers along the lines of: "Build it responsively with css, mediaqueries, javascript, etc...But as much as I would like to do that (and have done that before), The design (and the differences between the mobile and default versions) doesn't lend itself for responsive webdevelopment, at all Sad


Messages In This Thread
Loading different views when on a mobile browser - by El Forum - 10-29-2012, 08:12 AM
Loading different views when on a mobile browser - by El Forum - 10-30-2012, 08:58 AM
Loading different views when on a mobile browser - by El Forum - 10-31-2012, 02:56 AM
Loading different views when on a mobile browser - by El Forum - 11-01-2012, 08:18 AM
Loading different views when on a mobile browser - by El Forum - 11-05-2012, 03:59 AM
Loading different views when on a mobile browser - by El Forum - 11-05-2012, 04:03 AM
Loading different views when on a mobile browser - by El Forum - 11-11-2012, 11:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB