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.

 

Can Metamod handle this...?

Can Metamod handle this...?

I am demoing metamod and trying to schedule different youtube video to appear on specific days of the week. I have the youtube videos created as individual modules.

I have start time as 2010-10-01 and end time as 2014-10-31

In the php field in metamod config, I have the following code for seven of mine modules to test.

if ( MM_DAY_OF_WEEK == 1 ) return 150;
if ( MM_DAY_OF_WEEK == 2 ) return 151;
if ( MM_DAY_OF_WEEK == 3 ) return 152;
if ( MM_DAY_OF_WEEK == 4 ) return 153;
if ( MM_DAY_OF_WEEK == 5 ) return 154;
if ( MM_DAY_OF_WEEK == 6 ) return 155;
if ( MM_DAY_OF_WEEK == 7 ) return 156;
return 150;

However, only one video is showing everyday.

Thanks

Edited By: omojesu
14-Nov-10 10:42:11

omojesu
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Can Metamod handle this...?

Figured this out...here is what to do if anyone else is interested in using this as a recipe...

$r = array(); // an empty array
if ( MM_DAY_OF_WEEK == 1 ) $r[] = 150;
if ( MM_DAY_OF_WEEK == 2 ) $r[] = 151;
if ( MM_DAY_OF_WEEK == 3 ) $r[] = 152;
if ( MM_DAY_OF_WEEK == 4 ) $r[] = 153;
if ( MM_DAY_OF_WEEK == 5 ) $r[] = 154;
if ( MM_DAY_OF_WEEK == 6 ) $r[] = 155;
if ( MM_DAY_OF_WEEK == 7 ) $r[] = 156;
return $r; // may be empty, or contain any module id.

omojesu
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Can Metamod handle this...?

Hi omojesu,

there really shouldn't be any difference between the recipes you posted above. If you are checking for the day of week, then it can surely only be one of those values at a time, so you might as well use the first recipe.

If you're ever in a situation where the values you are checking could pass several of the checks (e.g. one check is for "monday" and one check is for "afternoons"), then do the array trick in the second recipe. This enables the checking to continue right through all the checks, accumulating module ids along the way. Then you return the final list at the end.

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

Re: Can Metamod handle this...?

OK, now something is definitely wrong somewhere. The expected modules suddenly stopped displaying. When I run metamod in debug mod, it is no longer showing any included modules even though it worked fine yesterday.

Here is the debug output
MetaMod debug info:
Module ID: 151
$option: com_content
$view: frontpage
$id:
$Itemid: 1
$timezone: America/Chicago
$language: en-us
$language_code: en
$language_region: us
Start date/time has been reached.
End date/time has not passed.
Including modules:

omojesu
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Can Metamod handle this...?

Oh, I think I know... Sunday is day 0, not day 7. Change the rule to check for that instead.

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

Re: Can Metamod handle this...?

That definitely was it. The module for Monday is showing today. Thanks

BTW: For the last else (return) line, how do you add the module if all conditions are not met in the array?

So, for example, if I want to display module 200 and 201if conditions in the array are not met, is it...
return $r; = 200, 201//
or
return 200, 201?

thanks

omojesu
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Can Metamod handle this...?

if you're using the 1st version (that has returns in each line) then use this at the end:

return "200,201";

If you're using the 2nd version with the array, then you need to detect if there was anything in the array in order to see if anything matched. So in that case, end it with:

if ( count($r) > 0 ) return $r;
return "200,201";

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
Total Posts Today:
2
User Info:
 
Total Users:
4366
Newest User:
chicagosepticpumping
Members Online:
2
Guests Online:
150


Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked