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 multiple modules

Display multiple modules

Hi,

is it possible to display multiple modules in one MetaMod module at the same time?

Thanks and best regards
Rooney

Rooney
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

Re: Display multiple modules

Hi Rooney,

yes, no problem.

If you are using the Quick Module ID Include, then you can put in a comma-separated list of ID numbers.
If you are using a PHP rule, then put in the list of ID numbers in quotes, like this:    if (...) return "101,102,331";

Another way to approach this is to put all the target modules into a new (fake) module position, then you can pull them all in together by returning the name of the module position instead of individual IDs. This means that you can change what goes in and what goes out simply by assigning arbitrary modules into/out of that module position.

example:
in Quick Module ID box, just enter the name of the module position,
in a PHP rule:   if (...) return "my_new_position";

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

Re: Display multiple modules

Thanks for your answer, but what I wanted to archive is the following:

if ( MM_DATE <= 20100222) return 34;
if ( MM_DATE <= 20100306) return 35;

Means I want to use one instance of MetaMod to display modules by date.

If I add multiple php statements, only one module is displayed.

Rooney

Rooney
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

Re: Display multiple modules

Oh, so you want to make it cumulative? e.g. you want to be able to set a number of rules, each one of which may add another module to the list that are displayed.

That's a great request -- I haven't really documented this sort of use anywhere, though I think a couple of the recipes on the site use something similar.

To do this, we'll set up an "array" at the beginning of the rule. It's a sort of collection to which we can add extra module IDs as we go through the rule. At the end, we just return the array. MetaMod is smart enough to go through the array and create a module for each ID.

Code:

$ret = array(); // start with empty array

if ( MM_DATE <= 20100222) $ret[] = 34; // add "34" to the array
if ( MM_DATE <= 20100306) $ret[] = 35; // add "35" to the array
return $ret;// it's ok if this is empty, it just returns no modules.

Hope that helps,
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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: Display multiple modules

metamodguy wrote:

Hope that helps,

Well, yes ;-)

On the right side, just above the donate button, there is a word: Impressed? I am. Support and component likewise.

Going the buy the pro version!

Rooney

Rooney
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10796
Newest User:
mokao3
Members Online:
0
Guests Online:
184

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