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.

 

Multiple positions at different dates?

Multiple positions at different dates?

Hello all, I'm trying to use MetaMod to load 4 different positions at different dates.  It's picking up the first one, however, it's not loading any others if the first one is active.  Here's the php code I'm using.  Any help is greatly appreciated.

if ( MM_DATE >= 20100821 && MM_DATE <= 20100828) return 156; // Position 1

if ( MM_DATE >= 20100815 && MM_DATE <= 20100828) return 159; // Position 2

if ( MM_DATE >= 20100815 && MM_DATE <= 20100816) return 160; // Position 3

if ( MM_DATE >= 20100815 && MM_DATE <= 20100816) return 161; // Position 4

Nocktis
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Multiple positions at different dates?

Anyone?  I'm still looking for a fix for this.

Nocktis
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Multiple positions at different dates?

Hi Nocktis,

Sorry for the delay in responding.

Can I just ask what you mean by "different positions"? Do you just mean "different modules which will load into the same position"? (hope so, as that's easier).
If you actually mean that you want to load different modules into different module positions, then you can achieve that inside a single module if you're using MetaMod Pro and the $changes mechanism - otherwise you need to set up a different MetaMod in each module position, and use the relevant rule in each of those positions.

Ok, so for now let's say that you want to load up a varying number of modules inside a single module position, i.e. a single MetaMod.

When you do a "return XXX;" like you are doing above, this immediately returns the module ID that you specified, so it will never get to the next line. Therefore you have to do things a little differently.

Try this way:

$results = array();
if ( MM_DATE >= 20100821 && MM_DATE <= 20100828) $results[] = 156;
if ( MM_DATE >= 20100815 && MM_DATE <= 20100828) $results[] = 159;
if ( MM_DATE >= 20100815 && MM_DATE <= 20100816) $results[] = 160;
if ( MM_DATE >= 20100815 && MM_DATE <= 20100816) $results[] = 161;
return $results;

This uses a thing called an "array" in PHP. It's a kind of list that holds a bunch of items. We start it off with an empty array, then add to it as the result of each check that we do. In the end, we return the array. If the array is empty, MetaMod won't display any items. If it has some items in it, then MetaMod will display those modules in the order you added them.

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

Board Info

Board Stats:
 
Total Topics:
1685
Total Polls:
6
Total Posts:
5912
Total Posts Today:
4
User Info:
 
Total Users:
11509
Newest User:
michael2154
Members Online:
0
Guests Online:
114

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