Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Hide module on mobile devices

Hide module on mobile devices

Hi!

I use this module
http://bowthemes.com/joomla-extensions/ … anner.html

I want to know, if I can hide that module on mobile devices (Android, iOS, Windows Phone) using the ModMeta module.
The floating banner can be viewed here www.novatag.dk

Thanks

Br.
Michael

MichaelT
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Hide module on mobile devices

Hi Michael,

yes, you can.

First, set up the floating banner module to "menu items: none" so that it does not show up at all.
Then set up a MetaMod in the same menu position. Use the following PHP code:

if ($core_genius->check("categorizr != mobile")) return XXX;
// replace XXX with the module ID of the floating banner module.

Best regards,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: Hide module on mobile devices

Hi Stephen,

Can you tell me what happens when Metamod "hides" a module. 

I am asking this because on a mobile version of the site I am working on I want a certain module not just to be hidden, but not to be activated at all.

With Twitter-Bootstrap, as I understand it, visible-desktop will "hide" a module from showing on a mobile phone, but it will still be downloaded to the device.

I want to disable the module completely when a person is looking at the site on their mobile device. 

This particular module is very bandwidth intensive, which is why I want to disable -- not hide -- it on mobile device such as a cell and even a tablet which is often using limited bandwith -- such as wifi (at a Starbucks) or a dataplan.

Is disabling the module possible with Metamod? Or like twitter bootstrap is it only hiding the module -- meaning that the module will still be downloaded to the mobile -- but will only be hidden from view.

ALSO I assume the recipe you included here work for  all or most  android/iphones / devices

Thanks!

Rowby

rowby
Junior Modder
ranks
useravatar
Offline
24 Posts
User info in posts
Administrator has disabled public posting

Re: Hide module on mobile devices

As I think about this, for my particular situation, I think I will go with a Chameleon Solution, if possible.  So if you wish to respond here (I *am* interested in knowing if the mod is hidden or disabled, just for future reference).

Let me see if the Chameleon solution will do it for me, for my particular convoluted situation.

I already have my question posted on the Chameleon forum.

Rowby

rowby
Junior Modder
ranks
useravatar
Offline
24 Posts
User info in posts
Administrator has disabled public posting

Re: Hide module on mobile devices

Hi Rowby,

MetaMod controls whether or not the target modules will be rendered. That is, if the MetaMod decides NOT to include a module, none of the HTML of that module will appear in the output at all. Therefore as long as you can successfully detect the right type of device you are targeting, MetaMod will make very sure that the HTML does or does not appear for the target module.

Note that this is the opposite of "responsive" techniques (but it still has an important role). With responsive techniques you generally want some HTML to appear there for all devices, but it only gets shown/activated according to JS and/or CSS breakpoints.

So, if you have a situation where for certain detectable classes of devices you definitely do not want certain modules to appear, then MetaMod will do that for you.

The "categorizr" detection in JomGenius (which is also that used for "desktop/mobile/tv/tablet" detection in Chameleon) is a mobile-first algorithm which does a great job at detecting these general classes of device.

e.g. in MetaMod:

if (!$core_genius->check("categorizr = mobile")) return 123; // only show module 123 on non-mobile devices

or

if (!$core_genius->check("categorizr = mobile, tablet")) return 123; // only show module 123 on devices that are not mobile and not tablet


Hope that clarifies,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1666
Total Polls:
6
Total Posts:
5909
Dormant:
User Info:
 
Total Users:
10095
Newest User:
johnson58
Members Online:
0
Guests Online:
151

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked