Jump to:

22992 Posts in 11842 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » EventsHolderPage with by date navigation

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: 431 Views
  • karibe
    Avatar
    Community Member
    56 Posts

    EventsHolderPage with by date navigation Link to this post

    Hello

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

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

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

    431 Views
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.