- XF Compatibility
- 2.1.x
- 2.2.x
- Headline
- A light-weight shim around Mobile_detect for XenForo 2
- Short Description
- Download and Discuss Premium, BusinessBrowser Detection 2.3.1 version on NullPro Community. It is zip Extention type and 41.6 KB File size. From Browser Detection have 6 discussion, 6 Updates, 464 Views.
A light-weight shim around Mobile_detect for XenForo 2 Usage (in templates) The add-on injects the global variable $mobileDetect, check that the variable is set before calling any methods to prevent errors during upgrades or if the add-on is disabled.
Usage (in php)
XF2.1 Page caching The integration mobile detection with XF2.1+ full-page caching, add to the config.php this;
Contributing features or bug fixes
Please create a Github Pull request via the "More information." link. Contributions If you appreciate this add-on, please consider a contribution via PayPal. Details will be provide via private conversation. Please contact me if you wish for different licencing arrangements. Licence See MobileDetectLicense.md for Mobile-Detect's licence (MIT licensed)
PHP:
<xf:if is="$mobileDetect && $mobileDetect.isMobile()"> Is Mobile <xf:else /> Not Mobile </xf:if>
PHP:
<xf:if is="$mobileDetect && $mobileDetect.is('Firefox')">
Is Firefox
<xf:else />
Not Firefox
</xf:if>
PHP:
<xf:if is="$mobileDetect && $mobileDetect.is('Chrome')">
Is Chrome
<xf:else />
Not Chrome
</xf:if>
PHP:
$mobileDetect = \SV\BrowserDetection\Listener::getMobileDetection();
$isMobile = $mobileDetect && $mobileDetect->isMobile() ? "_m1" : "_m0";
PHP:
$config['pageCache']['onSetup'] = function (\XF\PageCache $pageCache) {
$pageCache->setCacheIdGenerator(function(\XF\Http\Request $request) {
return \SV\BrowserDetection\CacheHelper::getPageCacheId($request);
});
};
Please create a Github Pull request via the "More information." link. Contributions If you appreciate this add-on, please consider a contribution via PayPal. Details will be provide via private conversation. Please contact me if you wish for different licencing arrangements. Licence See MobileDetectLicense.md for Mobile-Detect's licence (MIT licensed)