About Mobile Detect

Mobile Detect uses a lightweight PHP class for detecting mobile devices (including tablets).

Category 1Markup Generation
Markup modules that are called upon to generate or parse markup (like HTML). Markup modules are most often used on the front-end of a site (rather than admin).
Category 2Other Modules
Modules that have a unique purpose not covered by existing categories.
Release StateStable
Should be safe for use in production environments. *
Authorjustb3a
Module Version0.0.4
Class NameMobileDetect
Compatibility2.4, 2.5, 2.6, 2.7
Date AddedOctober 15, 2014
Last UpdatedJuly 24, 2015
Recommended ByNew recommendations may take up to 1 day to appear.

Instructions

This module's files should be placed in /site/modules/MobileDetect/
How to install or uninstall modules

README

ProcessWire Mobile Detect

Overview:

Mobile Detect uses a lightweight PHP class (Mobile_Detect) for detecting mobile devices (including tablets).

Designed for use with ProcessWire 2.4/2.5 http://processwire.com

Installation:

  1. Clone the module and place MobileDetect in your site/modules/ directory.
git clone https://github.com/justonestep/processwire-mobiledetect.git your/path/site/modules/MobileDetect
  1. Login to ProcessWire admin and click Modules.
  2. Click "Check for new modules".
  3. Click "install" next to the new SimpleContactForm module.

Usage:

This Module extends $config and sets the following parameters:

$config->mobileDetect = array(
  'deviceType' => 'deviceType (phone, tablet or desktop)',
  'browser' => 'mobile browser',
  'operatingsystem' => 'mobile operatingsystem',
  'device' => 'mobile device'
);

You can access them where ever you want.
See the example below:

  <body class="devicetype--<?php echo $config->mobileDetect->deviceType?>">
  <body class="devicetype--{{config.mobileDetect.deviceType}}"> // twig

Results in:

<body class="devicetype--phone"> OR
<body class="devicetype--tablet"> OR
<body class="devicetype--desktop">

Comments

No comments yet. Be the first to post!

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.