Disable field on mobiles

More
6 years 2 months ago - 6 years 2 months ago #74858 by ggppdk
Replied by ggppdk on topic Disable field on mobiles
Hello

We need use your library for detecting devices not only for fields, but also for our own elements in layout.

you can use this:
(the following code is e.g used inside image-gallery field)
Code:
$mobileDetector = flexicontent_html::getMobileDetector(); $isMobile = $mobileDetector->isMobile();  // Is Phone or Tablet $isTablet = $mobileDetector->isTablet();  // Is Tablet


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 6 years 2 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
6 years 2 months ago - 6 years 2 months ago #74860 by lipatovroman

ggppdk wrote: Hello

We need use your library for detecting devices not only for fields, but also for our own elements in layout.

you can use this:
(the following code is e.g used inside image-gallery field)
Code:
$mobileDetector = flexicontent_html::getMobileDetector(); $isMobile = $mobileDetector->isMobile();  // Is Phone or Tablet $isTablet = $mobileDetector->isTablet();  // Is Tablet


And then?
Code:
if ($isMobile || $isTablet) { echo "Yes"; }
Is it correct?
Last edit: 6 years 2 months ago by lipatovroman.

Please Log in or Create an account to join the conversation.

More
6 years 2 months ago - 6 years 2 months ago #74864 by ggppdk
Replied by ggppdk on topic Disable field on mobiles
Hello

$isMobile = $mobileDetector->isMobile();

includes the Tablet case already !
Code:
if ($isMobile) {   echo "Current client is phone or tablet";   echo $isTablet     ? "You are a Tablet"     : "You are a phone"; }


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 6 years 2 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
6 years 2 months ago - 6 years 2 months ago #74887 by lipatovroman

ggppdk wrote: Hello

$isMobile = $mobileDetector->isMobile();

includes the Tablet case already !

Code:
if ($isMobile) {   echo "Current client is phone or tablet";   echo $isTablet     ? "You are a Tablet"     : "You are a phone"; }


Hello!
Does  not work.
Displays error: Call to a member function isMobile() on null
I added this code in item.php
Code:
$isMobile = $mobileDetector->isMobile(); if ($isMobile) {   echo "Current client is phone or tablet";   echo $isTablet     ? "You are a Tablet"     : "You are a phone"; }
Last edit: 6 years 2 months ago by lipatovroman.

Please Log in or Create an account to join the conversation.

More
6 years 2 months ago #74888 by lipatovroman
This code works:
Code:
$mobileDetector = flexicontent_html::getMobileDetector(); $isMobile = $mobileDetector->isMobile(); $isTablet = $mobileDetector->isTablet(); if ($isMobile) {   echo "Current client is phone or tablet";   echo $isTablet     ? "You are a Tablet"     : "You are a phone"; }

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.383 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline