Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » [solved] Pre install question
[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) :
Is it possible to manage such feature with MetaMod, please ?
Thank in advance,
Regards
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
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
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.
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
- Index
- » MetaMod
- » MetaMod General Support
- » [solved] Pre install question
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Posts this week:
- 2
- User Info:
- Total Users:
- 7628
- Newest User:
- horlogekorting34
- Members Online:
- 1
- Guests Online:
- 161
- Online:
- horlogekorting34
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked