Skip to content

Instantly share code, notes, and snippets.

@hissy
Last active August 25, 2016 06:30
Show Gist options
  • Select an option

  • Save hissy/9616508 to your computer and use it in GitHub Desktop.

Select an option

Save hissy/9616508 to your computer and use it in GitHub Desktop.

Revisions

  1. hissy revised this gist Mar 18, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion view.php
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,8 @@
    // Prepare data for each page being listed...

    $pubTime = strtotime($page->getCollectionDatePublic());
    $new = ((time() - $pubTime) < (60 * 60 * 24 * 3)) ? '<p class="new">New</p>' : ''; // display "New" from 3 days before
    // 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... */ ?>

  2. hissy created this gist Mar 18, 2014.
    12 changes: 12 additions & 0 deletions view.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <?php foreach ($pages as $page):

    // Prepare data for each page being listed...

    $pubTime = strtotime($page->getCollectionDatePublic());
    $new = ((time() - $pubTime) < (60 * 60 * 24 * 3)) ? '<p class="new">New</p>' : ''; // display "New" from 3 days before

    /* The HTML from here through "endforeach" is repeated for every item in the list... */ ?>

    <?php echo $new?>

    <?php endforeach; ?>