Disable field on mobiles

2 months 1 week ago #74854 by ggppdk
Replied by ggppdk on topic Disable field on mobiles
Hello

about modules,
the setting exists already in our modules

about plugins
it was almost added 2 years ago ...

I know it is possible as mentioned above to do it at template code (do no add field at a position and and instead use IF and getFieldDisplay())
but totally agree it is good to have in field code itself
and once added , most users that will see it , will make use of it


-- 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 review. Thanks!

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

2 months 1 week ago #74856 by lipatovroman

ggppdk wrote: Hello

about modules,
the setting exists already in our modules

about plugins
it was almost added 2 years ago ...

I know it is possible as mentioned above to do it at template code (do no add field at a position and and instead use IF and getFieldDisplay())
but totally agree it is good to have in field code itself
and once added , most users that will see it , will make use of it


Yes, but we need more flexible abilities.
We need use your library for detecting devices not only for fields, but also for our own elements in layout.
Also we need to have ability to disable filtering and sorting on mobiles and allow it on desktops.
It's a key feature. 
My last site have 70% traffic from mobiles. I have to make pages lightweight and Google should see, that pages loading very fast.
Otherwise - no success. Other more fast CMS and optimized pages will displays in Google Top.

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

2 months 1 week ago - 2 months 1 week 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)
$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 review. Thanks!

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

2 months 1 week ago - 2 months 1 week 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)
$mobileDetector = flexicontent_html::getMobileDetector();
$isMobile = $mobileDetector->isMobile();  // Is Phone or Tablet
$isTablet = $mobileDetector->isTablet();  // Is Tablet


And then?
if ($isMobile || $isTablet) {
echo "Yes";
}
Is it correct?

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

2 months 1 week ago - 2 months 1 week ago #74864 by ggppdk
Replied by ggppdk on topic Disable field on mobiles
Hello

$isMobile = $mobileDetector->isMobile();

includes the Tablet case already !
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 review. Thanks!

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

2 months 5 days ago - 2 months 5 days ago #74887 by lipatovroman

ggppdk wrote: Hello

$isMobile = $mobileDetector->isMobile();

includes the Tablet case already !

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
$isMobile = $mobileDetector->isMobile();
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.

2 months 5 days ago #74888 by lipatovroman
This code works:
$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
© 2018 Flexicontent. All Rights Reserved.