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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Upcoming data based on date field and dataobjectmanager

Go to End



Community Member, 17 Posts

2 November 2011 at 5:05am

Edited: 02/11/2011 5:25am


I'm trying to get data from DOM based on date field and would like to display all todays and upcoming data in one page, but no old events anymore. Sort of a event list. I still need the old data for history graphs for later usage.

Template SS

<% if SoccerGameTips %>
<% control SoccerGameTips %>
  <ul id="resourceId">
    <li>$Date.Nice &raquo; <span class="bold">$TeamHome VS $TeamVisitor</span> &raquo; <span class="color1 bold">$Tip</span></li>
    <li><span class="legals">$GamePercentages</span></li>
<% end_control %>
<% end_if %>

And this is my SoccerGameTipPage.php


	class SoccerGameTipsPage extends Page
		static $has_many = array (
			'SoccerGameTips' => 'SoccerGameDetails'
		public function getCMSFields()
			$f = parent::getCMSFields();
			$f->addFieldToTab("Root.Content.SoccerGameTips", new DataObjectManager(
					'Date' => 'Date',
					'TeamVisitor' => 'TeamVisitor',
					'GamePercentages' => 'GamePercentages',
					'Tip' => 'Tip',
					'Description' => 'Description',
					'GameResult' => 'GameResult',
					'Won' => 'Won'


			return $f;

	class SoccerGameTipsPage_Controller extends Page_Controller

How should I limit the printing of data to only todays and upcoming data?