Skip to content

Instantly share code, notes, and snippets.

@animaux
Created February 19, 2019 21:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save animaux/b327312c0977bb39c99a552368eb67fa to your computer and use it in GitHub Desktop.
Save animaux/b327312c0977bb39c99a552368eb67fa to your computer and use it in GitHub Desktop.
Symphony CMS Custom Datasource. Displays next month as param in the param pool.
<?php
require_once(TOOLKIT . '/class.datasource.php');
class datasourcenext_month extends Datasource{
function about(){
return array(
'name' => 'Next Month',
'author' => array(
'name' => 'Alexander Rutz',
'website' => 'http://animaux.de'),
'version' => '0.1',
'release-date' => '2017-05-02T12:00:00+00:00');
}
function grab(array &$param_pool = null){
$year = Frontend::instance()->Page()->_param['this-year'];
$month = Frontend::instance()->Page()->_param['this-month'];
$date = mktime( 0, 0, 0, $month, 1, $year );
$next_month = strftime('%m', strtotime( '+1 month', $date ));
$next_months_year = strftime('%Y', strtotime( '+1 month', $date ));
$param_pool['next-month'] = $next_month;
$param_pool['next-months-year'] = $next_months_year;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment