Info
- 9 posts
- 6 voices
- Started 3 years ago by Dark Siren Sally
- Latest reply from ifuschini
- This topic is not resolved
Change theme if mobile browser detected.
-
- Posted 3 years ago #
I'm using Tera-WURFL to detect whether my bbpress forum is being accessed by a mobile browser.
I also have a specific theme (1col_fixed, I think it's called) that works very nicely in mobile browsers.
Now, what I want to do is to have bbpress use the 1col_fixed theme when a mobile browser is detected, and use my default theme otherwise. What function(s) do I call to set the currently activated theme to a different theme? And how do I make it 'stick' just for the mobile user -- cookies? sessions?
Thanks so much if anyone can help me.
-
- Posted 3 years ago #
Sounds like you have the mobile browser agent stuff figured out with the Tera-WURFL library. So, when you detect a mobile browser, you want to display your forum using the1col_fixed theme? Looks like it checks for a match to a mobile browser like this:
$matched = $wurflObj->getDeviceCapabilitiesFromAgent($_SERVER['HTTP_USER_AGENT']); // see if this client is on a wireless device (or if they can't be identified) if(!$matched || !$wurflObj->getDeviceCapability("is_wireless_device")){ echo "<h2>You should not be here</h2>"; }
So, instead of the <h2> message they are displaying, you could use a theme switcher plugin to set the theme and direct someone to that URL. How about something like this:http://bbpress.org/plugins/topic/bbpress-theme-switcher/
That plugin says it uses cookies to persist the theme choice.
-
- Posted 3 years ago #
If you don't want to use a MySql you can use "Apache Mobile Filter".
More info: http://www.idelfuschini.it/apache-mobile-filter.html -
- Posted 2 years ago #
Hi ,
I'm Idel Fuschini, I have published the new version of Apache Mobile Filter.The module detects the mobile device and passes the WURFL capabilities on to the other web application as environment variables. It can also be used to resize images on the fly to adapt to the screen size of the mobile device.
Read more info here: http://www.idelfuschini.it/it/apache-mobile-filter-v2x.html
-
- Posted 2 years ago #
Hi,
Another way of detecting whether the device is mobile or not is detectFree
http://www.moviladetection.com/detectfree
all you need is a small Javascript to each site.or you can use Movila Detection proxy which is also free.
http://www.moviladetection.comHope this helps.
-
- Posted 2 years ago #
we use handsetdetection.com to detect the device and other details. Having said that, i would be interested to hear about other providers out there.
-
- Posted 2 years ago #
@ifuschini that's very nice, but unfortunately, i think most webmasters don't have access to their httpd.conf file (that's including me)
-
- Posted 2 years ago #
chandersbs. You have right, but you can ask to install it in you virtual host.
-
- Posted 2 years ago #
Another info, from 07th Octorber 2009 the Apache Mobile Filter has include in Apache Module Registry:
-
You must log in to post.