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.

 

Switching between 2 module

Switching between 2 module

Hello,
I already have the code that I need to randomly switch between each module.

if ( rand( 1,2 ) == 1 ) return 123;
else return 124;

Now I would like to add a session cookie for each visitor so that the module does not change while they browse the website. Can you help me?

Thank you for your time
Nick

localinternet
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Switching between 2 module

Code:

$r = @$_SESSION["random_modules"];

if ($r == null) {
  $r = mt_rand(1,2);
  @$_SESSION["random_modules"] = $r;
}
if ($r == 1) return 123;
if ($r == 2) return 124;

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

Board Info

Board Stats:
 
Total Topics:
1685
Total Polls:
6
Total Posts:
5912
Total Posts Today:
4
User Info:
 
Total Users:
11509
Newest User:
michael2154
Members Online:
0
Guests Online:
112

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