Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

SOLVED: Blog module with expire date on blog entries


Reply


991 Views

Avatar
frabraha

Community Member, 49 Posts

27 October 2009 at 3:52am

Edited: 27/10/2009 10:32pm

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;
}