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.

 

Browser specific metamod

Browser specific metamod

Hi,

I am setting up a module to display a navigation in ie6 that is not the navigation i have for all the other browsers. I have been reading through previous messages and the FAQ. I have read how you need to set none for the menu assignment. Despite making sure there are no menu assignments set, and trying both a position and an ID, i am still getting two menus to show up on the ie6 browser. The other browsers are fine. Also, when I turn off the metamod I have set up for the other browsers, only one browser shows up for ie6. I have also tried both recipes for the browser specific code, and just purchased metamod pro to see if that would solve the problem. Any help you could give would be greatly appreciated. Thanks for the help! Great mod btw.

Seth

stbearabus
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Browser specific metamod

Hi Seth,

Here's an overview of how this should work, if I understand you correctly.

(1) You want one navigation to appear for IE6, and another for all other browsers.
(2) Therefore you have 2 "target" modules. You want one to appear in one case (ie6), and the other to appear in the other cases (non-ie6)
(3) Therefore, set both target modules to "disabled" so they don't show up until included in a MetaMod
(4) Set up a MetaMod in the module position that is going to display one of the 2 modules
(5) Use a PHP rule that checks for IE6, and if found includes one module, and if not, includes the other module.

A rule that does that might look like:

Code:

$UA  = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';

$IE  = strstr($UA, 'MSIE') ? true : false;
$IEV = $IE ? preg_split('/msie/i', $UA) : false;
$IEV = $IEV ? floatval($IEV[1]) : false;

// Customise the module return numbers as appropriate for your site.
if ($IE and $IEV == 6) return XXX; // module ID for IE6
return YYY; // module ID for non-IE6

Hope that helps,
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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: Browser specific metamod

That did help! Thank you very much. What I had done is set up two MetaMods, one for ie6 and one for everything else. I either missed or could not find the code that was set for all the other no ie6 browsers - i.e. return YYY; // module ID for non-IE6. Was that included in the recipe? Thank you so much for your help on this. Fantastic module.

Seth

stbearabus
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Browser specific metamod

Hi Seth,

I'm glad this is working for you smile

The "fallback" rule at the end is actually in the example on the recipes page, though it's labelled slightly differently:

Code:

return 66; // if none of the preceding rules apply, use this module id.

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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: Browser specific metamod

Hello! This is a great module! THank you very much for it! But i've got a similar problem with checking user's browser and in my case this should be Opera ( it's not processing JS correctly so i want to replace my js based module with another one. So could you help me with this problem. I understand that i need to replace some variables in an example you've given above  but i can't figure out how to do that  to make it work correct. Thanks in advance man!

firstline
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Browser specific metamod

The full recipe is found on: http://www.metamodpro.com/metamod/recip … -detection

But if you just want to display an alternative module for Opera users, you could use this:

$UA  = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
$OP  = strstr($UA, 'Opera') ? true : false;
if ($OP) return XXX;
else return YYY;

// replace XXX with the module id to use for Opera users, and YYY with the module ID to use for all other browsers.


Hope that helps,
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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: Browser specific metamod

hell yeah! everything is working great now! thank you so much!

firstline
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10778
Newest User:
negina4qx
Members Online:
0
Guests Online:
146

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