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.

 

[solved] Pre install question

[solved] Pre install question

Hi all,

I'm looking for an extension to change randomly the display of 6 modules on the frontpage of my website at each loading : http://www.web-eau.net/ (J! 3.2) :
https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-prn1/t1/1560669_300607940093367_1589552492_n.jpg

Is it possible to manage such feature with MetaMod, please ?

Thank in advance,
Regards

Goustaf
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Re: [solved] Pre install question

Hi Goustaf,

yes, MetaMod may be able to help. It depends a little on how the modules are assigned to the page at the moment. There are various ways that the image above could have been generated with modules:

1 - it could be 6 different module positions, each with 1 module assigned
2 - it could be 2 different module positions (e.g. left and right) each with 3 modules assigned, and the modules display downwards
3 - it might be 1 module position with 6 modules assigned to it, and the module position knows how to lay out modules in rows and columns
4 - it might be 1 module position with 1 module assigned, and that 1 module displays 6 things in it, perhaps derived from articles or other modules. (this is complicated but there are modules out there that work this way)

I'll outline how I would use MetaMod to achieve shuffling of the 6 modules according to scenario 3 above.

a - set up the 6 modules as normal EXCEPT assign them to "menu items: none".
b - set up a MetaMod in the module position where you want the 6 modules to appear
c - publish the MetaMod and assign it to as many pages as you want to appear on.
d - in the MetaMod use the following PHP code:

$mods = array(11,12,13,14,15,16); // substitute these with the module ids of the 6 modules you want to display
shuffle($mods); // randomise them
return $mods; // display them

e - save the MetaMod and test.

I trust this helps. If the modules are set up one of the other ways, let me know which one and I'll try to suggest an alternative method.

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

Re: [solved] Pre install question

Hi Stephen,

Thank you for your answer.
According to your demand, my scenario is 2) = 2 different module position and 3 module assigned on each position.

Thank in advance for your support and help.
Regards,
Goustaf

Goustaf
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Re: [solved] Pre install question

Hi Goustaf,

depending on how random these need to be you could do it 2 ways. The easiest is if you keep the same 3 modules in the left, and same 3 on the right, and just set up a MetaMod in each position (1 in left and 1 in right) and do the "shuffle" on each set.

If you want to completely randomise them it's a little more complex, as you need to communicate between the 2 modules so that the first one shuffles them and displays the 1st 3, and the 2nd one displays the last 3.

You can do the latter one like this:

1 - set up 2 MetaMods, 1 assigned to each position (left and right)

2 - in each, use the following code:

global $shufflemods = null;
if ($shufflemods == null) {
  $shufflemods = array (11, 12, 13, 14, 15, 16); // put in your 6 module ids here
  shuffle($shufflemods);
  $new = array(array_pop($shufflemods),array_pop($shufflemods),array_pop($shufflemods));
  return $new;
}
return $shufflemods; // the remaining 3

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: [solved] Pre install question

you're awesome, Stephen !
I will test it as soon as possible and give you a feedback here (and a positive reviw on JED).

Goustaf
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Re: [solved] Pre install question

Ok Stephen, I'm back with a small error...
Parse error: syntax error, unexpected '=', expecting ',' or ';' in /homepages/29/d209415814/htdocs/my-website/modules/mod_metamod/helper.php(628) : eval()'d code on line 1

What I've done :
1- set up a Metamod on each position (bottom 1 and bottom2)
2- on each, I've copied and pasted the code you given (changed the modules IDs)

The error is display on bottom 1 and bottom 2.

Goustaf
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Re: [solved] Pre install question

I've unpublished JCH Optimized and the error message doesn't appear any more.
2 modules Metamod are setup like you've suggested but without any effect.

Goustaf
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Re: [solved] Pre install question

I thought I had replied to this but maybe it was another thread.

Anyway there was a slight error in my suggested PHP code that was causing the problem. Use the following INSTEAD of what was in earlier posts:

global $shufflemods;
if ($shufflemods == null) {
  $shufflemods = array (11, 12, 13, 14, 15, 16); // put in your 6 module ids here
  shuffle($shufflemods);
  $new = array(array_pop($shufflemods),array_pop($shufflemods),array_pop($shufflemods));
  return $new;
}
return $shufflemods; // the remaining 3

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: [solved] Pre install question

It's just brilliant and perfect, Stephen ! Thank you very much, your support is awesome.

As I've promised, I will post a very positive review on the JED.

Goustaf
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1686
Total Polls:
6
Total Posts:
5940
Total Posts Today:
1
User Info:
 
Total Users:
5198
Newest User:
Paramountdental
Members Online:
0
Guests Online:
111

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