Jump to:

23453 Posts in 18904 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » SOLVED: Blog module with expire date on blog entries

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 941 Views
  • frabraha
    Community Member
    49 Posts

    SOLVED: Blog module with expire date on blog entries Link to this post

    I have manage to make the blog entries with expiry date. This works just fine, but I have another little problem now. When I use the archive the entries doesn't show because the date on those have expired.

    Any ideas on how this can be solved.

    Heres the code for the expire date..

    In BlogEntires.php

       function ExpiresDoNotShow() {
          $now = strtotime('now');
          if($this->owner->DateOut && strtotime($this->owner->DateOut) < $now) {
             return false;
          } else {
           return true;

    In BlogSummary.ss

    <% if ExpiresDoNotShow %>...<% end_if %>

    Add this in the function ExpiresDoNotShow

    if (Director::urlParam('Action') && Director::urlParam('Action') != "tag" ) {
    return true;

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.