[pmwiki-users] Skin for Mobile Browsers

Patrick R. Michaud pmichaud at pobox.com
Mon Oct 16 16:55:14 CDT 2006


On Mon, Oct 16, 2006 at 05:35:20PM -0400, S. William Schulz wrote:
> As a followup to this, is there an easy way (link appreciated) to
> allow two views of the same wiki, e.g. http://www.wiki.org shows the
> standard two-column interface, and http://m.wiki.org shows the same
> wiki with a one-column theme like this?
> 
> I am looking to make our data available to BBerry users.

Sure!  Simply change the skin based on the value of the
$_SERVER['HTTP_HOST'] variable.


    ##  default skin is 'pmwiki'
    $Skin = 'pmwiki';

    ##  but use 'mobile' skin if someone is accessing via m.wiki.org:
    if ($_SERVER['HTTP_HOST'] == 'm.wiki.org')
      $Skin = 'mobile';


In a couple of cases I've also used the HTTP_USER_AGENT and/or
HTTP_ACCEPT variables to select a skin:

    ##  wap-enabled browsers get a mobile skin
    if (preg_match('!text/vnd\\.wap\\.wml!', @$_SERVER['HTTP_ACCEPT']))
      $Skin = 'mobile';

    ##  blackberrys get their own skin
    if (preg_match('!blackberry!i', @$_SERVER['HTTP_USER_AGENT']))
      $Skin = 'blackberry';


Pm




More information about the pmwiki-users mailing list