Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hissy
Last active August 25, 2016 06:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hissy/9616508 to your computer and use it in GitHub Desktop.
Save hissy/9616508 to your computer and use it in GitHub Desktop.
#concrete5 #PageList How to display an icon with the page published date while specific time
<?php foreach ($pages as $page):
// Prepare data for each page being listed...
$pubTime = strtotime($page->getCollectionDatePublic());
// 60 seconds, 60 minutes, 24 hours, 3 days
$new = ((time() - $pubTime) < (60 * 60 * 24 * 3)) ? '<p class="new">New</p>' : '';
/* The HTML from here through "endforeach" is repeated for every item in the list... */ ?>
<?php echo $new?>
<?php endforeach; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment