Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Can Metamod handle this...?
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
14-Nov-10 11:42:11
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.
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
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:
Re: Can Metamod handle this...?
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
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";
- Index
- » MetaMod
- » MetaMod General Support
- » Can Metamod handle this...?
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5944
- Posts this week:
- 1
- User Info:
- Total Users:
- 7671
- Newest User:
- kiresidencescondo2
- Members Online:
- 1
- Guests Online:
- 112
- Online:
- eugene4916
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked