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.

 

Show module ,depends on value of cookie

Show module ,depends on value of cookie

Hi, there
is it possible to show different module depending on the value of the cookie .
Let's say cookie "style" with a value "sports" - shows module 155
cookie "style" with a value "weather" - shows module 156 and etc.

Thanks,
Best Regards,
A. Todorov

delxy
Beginner Modder
ranks
useravatar
Offline
8 Posts
Administrator has disabled public posting

Re: Show module ,depends on value of cookie

Sure - it's no problem to get cookie values inside MetaMod.

Code:

$style = JRequest::getVar("style","","cookie");

if ($style == 'sports') return 155;
if ($style == 'weather') return 156;
//etc

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

Re: Show module ,depends on value of cookie

Thanks a lot ,saved my day smile

P.S.
Great support

delxy
Beginner Modder
ranks
useravatar
Offline
8 Posts
Administrator has disabled public posting

Re: Show module ,depends on value of cookie

Dear Stephen

$style = JRequest::getVar("style","","cookie");

if ($style == 'sports') return 55;

if ($style == 'weather') return 56;

Is it everything right? Because ,it's not working , I set a cookie named: style with content "sports" , but module 55 doesn't appear.

Regards ,
A. Todorov

delxy
Beginner Modder
ranks
useravatar
Offline
8 Posts
Administrator has disabled public posting

Re: Show module ,depends on value of cookie

Hi,

how about trying this, just to make sure that you're getting hold of the right information, and that the MetaMod is assigned to the right pages:

$style = JRequest::getVar("style","","cookie");
echo "Style cookie is $style<br  />";

Then make sure that you can see that output in the module position, and that it has the right information in it. If you don't see the right value for "style" then there's something wrong with the cookie mechanism. If you don't see any output from this at all, then either the MetaMod isn't assigned to the page, or you may have other settings in the MetaMod which mean that it doesn't get as far as executing the PHP code.

Also try turning on debug mode to see what appears.

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

Re: Show module ,depends on value of cookie

Hi,
Thanks,
It seems the problem is the module i tried it with a different one and it works perfect.

Regards,
Anton

delxy
Beginner Modder
ranks
useravatar
Offline
8 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1698
Total Polls:
6
Total Posts:
5944
Posts this week:
4
User Info:
 
Total Users:
5534
Newest User:
kaylee
Members Online:
0
Guests Online:
174

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