Full version of mobile site

Permalink
I followed the directions by Andrew to set up a mobile theme:

http://www.concrete5.org/help/building_with_concrete5/developers/th...

which worked wonderfully - I just had one additional question. With the way Andrew describes setting up the theme switcher - does that leave any possible way to give the visitor the option to switch to the "full" version of the site if they so choose, rather than being permanently stuck in the mobile theme?

hursey013
 
nteaviation replied on at Permalink Reply
nteaviation
I have played with that setup on one of my developement servers and it worked great. I don't know of an easy way "flip" the mobile browser switch. The code keys off the _SERVER["HTTP_USER_AGENT"] and switches based on that information. Maybe Andrew has a "trick up his sleeve". That would be a nice feature.

I wish their was a Blackberry compatible mobile theme that I could use this with :)
hursey013 replied on at Permalink Reply
hursey013
If you modify the c5touch theme a little it will work/look exactly the same on a blackberry as it does on an iphone. I will have an example shortly that you can review.
nteaviation replied on at Permalink Reply
nteaviation
Sweet! Thank you very much, .css and I don't get along very well :) LOL
12345j replied on at Permalink Reply
12345j
replace
class ThemeSwitcher {
   public function checkForIphone($view) {
      if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') > -1) {
         $iphone = PageTheme::getByHandle('c5touch');
    $view->setTheme($iphone);
      }
   }   
}
with
<?
class ThemeSwitcher {
   public function checkForIphone($view) {
      if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Android') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Blackberry') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'OperaMobi') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'IEMobile') ||    strstr($_SERVER['HTTP_USER_AGENT'], 'webOS')) {
         $iphone = PageTheme::getByHandle('c5touch');
         $view->setTheme($iphone);
      }
   }
}
this won't display c5touch differently on a a blackberry, but it will display c5touch. if you want to display it differently on a blackberry, create an alternate verion of c5touch, like c5touch1. then use this code.
class ThemeSwitcher {
   public function checkForIphone($view) {
      if (strpos($_SERVER['HTTP_USER_AGENT'], 'Blackberry') > -1) {
         $iphone = PageTheme::getByHandle('c5touch1');
    $view->setTheme($iphone);
      }
   }   
}

as for displaying the desktop version, basically you would need a button that would force the blackberry to fake its user agent, which i don't think is possible.
StriderSEO replied on at Permalink Reply
StriderSEO
Wouldn't it be possible to set a cookie if the user opts for the full version, then have the theme switcher check for the cookie first, then revert to user agent?
12345j replied on at Permalink Reply
12345j
Yeah maybe but I don't know how you'd make something like that though
bryanlewis replied on at Permalink Reply
bryanlewis
I'm hoping c5 comes out with a mobile default theme like plain yogurt. everyone needs it. I think it would help c5 out getting people converted over to c5.
12345j replied on at Permalink Reply
12345j
Yeah that would be good, I have mobile theme in submission but preloaded would be sick. I'd use maybe 2-3 more default theme
12345j replied on at Permalink Reply
12345j
tell me if you come out with anything that would work, Im building a mobile them and that would be a great feature for it.