I've gone down the path of making my magento store mobile friendly. At first I started using the simple magento configuration theme exceptions to display the mobile theme to visitors with mobile browsers, until I realised that I actually needed to make a new store view just for the theme. There are several extensions that I need to disable with the mobile site.
So I have my mobile site, m.website.no, and my main site, www.website.no - I have code in index.php that runs magento with the store code for the mobile site or the main site depending on the request. It also redirects to the mobile site if a mobile user agent is detected.
Now it's all very well to make a mobile site and redirect visitors to it based on user agent, but what if they want to view the desktop site? One makes a link to the main site, right? It would go to www.website.no - but then the visitor is looped back to the mobile site again... so the next step in the logic, is to set a variable like this: www.website.no/?desktop=1. If I want it to stick, then I have to put that in a session variable or a cookie or something.
My problem - in index.php, magento isn't even loaded! So how do I go about setting or getting a session variable through magento (e.g. Mage::getSingleton('core/session')->setIsDesktop(true); ) before it's even loaded? Am I going about this completely the wrong way? Do I have to extend magento or something so it switches store if the user has specifically asked for the main site? Giant headache.