Difference between revisions of "Timed Cascade Rules"
TMMStephenY2 (talk | contribs) |
TMMStephenY2 (talk | contribs) |
||
Line 26: | Line 26: | ||
<input type="radio" name="cascade" checked="checked" value="{smarty_function_output_this_hours_cascade_name}"} /> | <input type="radio" name="cascade" checked="checked" value="{smarty_function_output_this_hours_cascade_name}"} /> | ||
</pre> | </pre> | ||
+ | |||
=== Code === | === Code === |
Revision as of 14:05, 4 June 2010
NATS 3
|
---|
NATS3 and NATS4 both offer the option to have specific cascades only be displayed at certain times of the day, which can be set by Timed Cascade Rules.
NATS4
Go to Billers Admin, setup your cascades, and click the Edit Cascade Rules icon. Once you are in the Edit Cascade Rule section, click the Advanced Form link to set up a Timed Cascade Rule. In the Advanced Form fields you can use show (enable) and hide (disable) rules to show and hide cascades for a specific time period. To set up start and end times for your Timed Cascades, enter a freeform date or time in the Start Time and End Time fields.
If a disable rule and an enable rule exist at the same time, the disable rule will take precedence over the enable rule.
NATS3
The following PHP code returns a different cascade shortname at different times of the day, which will allow you to switch between different Timed Cascades.
To use it, install it in your Smarty plugins directory, create or enable two Hidden Cascades, set the $defaultCascadeName and $specialCascadeName to the shortnames of your two hidden cascades, and Manually add a cascade to your join form.
Use this Smarty function to set the value parameter in your cascade form. For example:
<input type="radio" name="cascade" checked="checked" value="{smarty_function_output_this_hours_cascade_name}"} />
Code
<?php /* change the cascade based on hour of the day */ /* For more details, please see http://wiki.toomuchmedia.com/index.php/Timed_Cascade_Rules /* NOTE : this does not check whether or not your cascades are setup properly */ /* USE AT YOUR OWN RISK -- NO WARRANTY PROVIDED */ function smarty_function_output_this_hours_cascade_name() { $startHour = 10; $endHour = 13; $defaultCascadeName = 'default'; $specialCascadeName = 'default2'; $currentTime = localtime( mktime() , 1); return $currentTime['tm_hour'] >= $startHour && $currentTime['tm_hour'] < $endHour ? $specialCascadeName : $defaultCascadeName; } ?>
Credits
- Special thanks to Nick Hahn for assistance with this article.