Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- class Home extends CI_Controller {
- public function __construct ()
- {
- parent::__construct();
- $this->load->helper("html");
- function detect_mobile()
- {
- if(preg_match('/(alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|ipad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|playbook|sagem|sharp|sie-|silk|smartphone|sony|symbian|t-mobile|telus|up.browser|up.link|vodafone|wap|webos|wireless|xda|xoom|zte)/i', $_SERVER['HTTP_USER_AGENT']))
- return true;
- else
- return false;
- }
- }
- function index(){
- $mobile = detect_mobile();
- if($mobile === true)
- {
- $data["title"]="Mobile";
- $this->load->view("v_mobile",$data);
- }else{
- $data["title"]="Dekstop";
- $this->load->view("v_dekstop",$data);
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment