Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change theme if mobile browser detected.

  • @dark-siren-sally

    Member

    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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • @chrishajer

    Participant

    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:

    https://bbpress.org/plugins/topic/bbpress-theme-switcher/

    That plugin says it uses cookies to persist the theme choice.

    @ifuschini

    Member

    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

    @ifuschini

    Member

    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

    @moviladetection

    Member

    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.com

    Hope this helps.

    @magicdesign2000

    Member

    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.

    @chandersbs

    Member

    @ifuschini that’s very nice, but unfortunately, i think most webmasters don’t have access to their httpd.conf file (that’s including me)

    @ifuschini

    Member

    chandersbs. You have right, but you can ask to install it in you virtual host.

    @ifuschini

    Member

    Another info, from 07th Octorber 2009 the Apache Mobile Filter has include in Apache Module Registry:

    http://modules.apache.org/search.php?id=1787

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar