Trying to make mobile detect plugin

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
danguss
New Member
New Member
Posts: 7
Joined: Wed Jul 11, 2018 6:24 pm

Trying to make mobile detect plugin

Post by danguss »

I found this old thread on mobile detect. I want to implement it.
viewtopic.php?f=7&t=66545

I created my UDT "mobile_detect".
then added {mobile_detect} to my template and trying to get conditional with {$deviceType} to work.
but no response, not sure where to put my mobile_detect.php class

Code: Select all

function smarty_function_mobile_detect($params, $smarty)
{
include_once('/mobile_detect.php');
$detect = new Mobile_Detect;
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
$smarty->assign('deviceType', $deviceType);
}
cmsms 2.2.7
server has 7.1 php
User avatar
Rolf
Dev Team Member
Dev Team Member
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Trying to make mobile detect plugin

Post by Rolf »

The CGExtensions module already has a mobile detect plug-in included. Check the help text.

Grtz Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
danguss
New Member
New Member
Posts: 7
Joined: Wed Jul 11, 2018 6:24 pm

Re: Trying to make mobile detect plugin

Post by danguss »

Rolf wrote:The CGExtensions module already has a mobile detect plug-in included. Check the help text.

Grtz Rolf
But it doesn't work for all mobile devices for example it doesn't recognize a lot of samsung models
User avatar
Rolf
Dev Team Member
Dev Team Member
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Trying to make mobile detect plugin

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Locked

Return to “Modules/Add-Ons”