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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

SOLVED: Blog module with expire date on blog entries


Go to End


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