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:

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

EventsHolderPage with by date navigation

Go to End



Community Member, 56 Posts

9 September 2009 at 1:26am


I'd like to navigate throe events on eventsHolder page by navigations links like that:

			Select period:<br />
			<select name="">
			<% control eventsNav.months %>
				<option <% if $key==$currentMonth %>selected="selected"<% end_if %> value="$key">$value</option>
                        <% end_control %>
<!-- same with years -->

What should look like data structure on EventsPageHolder_Controller class to use similar template. I have two hash arrays that should be
pattern for sapphire data structures:

	private $months = array(
		0  => "Jan",
		1  => "Feb",
		2  => "Mar",
	private $years = array(
		2008 => 2008,
		2009 => 2009,
		2010 => 2010,

and controller method

 	public function eventsNav()
 		$result = new DataObjectSet();
		$months = new DataObjectSet();
		$years = new DataObjectSet();
		$result->push(array("currentMonth" => $this->month));
		$result->push(array("currentYear" => $this->year));
		return $result;