Skip to content

Instantly share code, notes, and snippets.

@amolok
Created February 5, 2020 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amolok/2433fa4889eae398e125b1471ea3369f to your computer and use it in GitHub Desktop.
Save amolok/2433fa4889eae398e125b1471ea3369f to your computer and use it in GitHub Desktop.
<?php
if ($start && date("Y") != $start) {
$output = $start.'–'.date("Y");
} else {
if($start)$output = $start;
else $output = date("Y");
}
return $output;
@amolok
Copy link
Author

amolok commented Feb 5, 2020

Displays start year to current year or just current year: 2020–2021
Usage:

  • Create MODx snippet named year and copypaste gist into it.

  • Put this chunk in your footer template: [[!year? &start=`2019`]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment