Skip to content

Instantly share code, notes, and snippets.

@bwente
Last active October 18, 2016 00:59
Show Gist options
  • Save bwente/a5ba17b880cc6f77d67c to your computer and use it in GitHub Desktop.
Save bwente/a5ba17b880cc6f77d67c to your computer and use it in GitHub Desktop.
Show chunk inline at a scheduled time.
<?php
// [[!showMe? &start=`` &stop=`` &display=`featuresChunk` &default=`emptyChunk`]]
$start = strtotime($modx->getOption('start',$scriptProperties,time()));
$stop = strtotime($modx->getOption('stop',$scriptProperties,time()));
$display = $modx->getOption('display',$scriptProperties,'');
$default = $modx->getOption('default',$scriptProperties,'');
$rightNow = time();
if($rightNow > $start && $rightNow < $stop){
$output = $modx->getChunk($display);
} else {
$output = $modx->getChunk($default);
}
return $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment