I’m kinda new to codeigniter, and totally new to the forums, so bear with me
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,