1. Go to this page and download the library: Download chronon/mobile_detect library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
php
public function beforeFilter() {
// check if the request is 'mobile', equest is mobile, but not a tablet, activate the mobile layout
$this->_setMobile();
}
}
}
protected function _setMobile() {
$this->theme = 'Mobile';
// etc...
}
protected function _isTablet() {
if ($this->Session->check('tablet')) {
return $this->Session->read('tablet');
}
// load the component
$this->MobileDetect = $this->Components->load('MobileDetect.MobileDetect');
// pass the component the 'isTablet' method
$result = $this->MobileDetect->detect('isTablet');
$this->Session->write('tablet', $result);
return $result;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.