Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Random modules on front page only
Page:
1
Random modules on front page only
Random modules on front page only
Hi,
I have the following to display a single mod on the homepage ( homepage is both joomla and virtuemart homepage ):
Code:
$vm = JomGenius("virtuemart");
if ($vm and ($option != "com_virtuemart" or $vm->check("pagetype = frontpage") or $vm->page == "shop.index" ) ) return 62;
But I now want the mod displayed to be a random selection from 5 available mods. I know I need something like this incorporated:
Code:
$r = mt_rand(1,5);
if ($r == 1) return 62;
if ($r == 2) return 69;
if ($r == 3) return 70;
if ($r == 3) return 71;
if ($r == 3) return 72;
Just not sure how to combine the two though. I've tried a few things but my coding skills are not really up to scratch !!
Grateful for any help.
Thanks a lot.
Q
Administrator has disabled public posting
Re: Random modules on front page only
Sorry for the delay - took some time off to spend with my kids in their school holidays.
Try the code this way:
Code:
$vm = JomGenius("virtuemart");
if ($vm and ($option != "com_virtuemart" or $vm->check("pagetype = frontpage") or $vm->page == "shop.index" ) ) {
$r = mt_rand(1,5);
if ($r == 1) return 62;
if ($r == 2) return 69;
if ($r == 3) return 70;
if ($r == 3) return 71;
if ($r == 3) return 72;
}
Hope that helps,
Stephen
Administrator has disabled public posting
Page:
1
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Random modules on front page only
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:
- 0
- Guests Online:
- 171
- 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