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.

 

Display random

Display random

Hi,

Just wonder if it's possible to display random modules from a specific module position with meta mod?

prehn
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Display random

Hi,

that's a good question. Yes, there will be a way of doing a database query to get all the modules assigned to a certain position, then you could randomise these. In fact one of the "recipes" does something a bit similar to this:

http://www.metamodpro.com/metamod/recip … not-appear

So you could try this:

$sql = 'SELECT id from #_' . '_modules m ' .
  "WHERE m.position =  'left-metamod' " .
  'and m.published = 1 ';
$db->setQuery( $sql );
$mods = $db->loadColumn();
if (count($mods)) {
  shuffle($mods);
  return $mods[0];
}

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

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
3
User Info:
 
Total Users:
4397
Newest User:
tull687318
Members Online:
0
Guests Online:
148

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