Skip to content

Instantly share code, notes, and snippets.

@hissy
Created January 16, 2014 04:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hissy/8450002 to your computer and use it in GitHub Desktop.
Save hissy/8450002 to your computer and use it in GitHub Desktop.
[concrete5] Detect mobile browser and switch mobile block template from default custom template.
<?php defined('C5_EXECUTE') or die("Access Denied.");
Loader::library('3rdparty/mobile_detect');
$md = new Mobile_Detect();
if ($md->isMobile()) {
include('mobile.php');
} else {
include('default.php');
}
@hissy
Copy link
Author

hissy commented Jan 16, 2014

  • blocks/block_handle/templates/template_handle/view.php
  • blocks/block_handle/templates/template_handle/default.php
  • blocks/block_handle/templates/template_handle/mobile.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment