Jump to:

10845 Posts in 2516 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » [Solved] EventCalendar OtherDates totals

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 813 Views
  • mathiasmex
    Avatar
    Community Member
    28 Posts

    [Solved] EventCalendar OtherDates totals Link to this post

    Hi Uncle Cheese,

    maybe you can help me out (please ?).

    I'm trying to show the total amount of days for an event in the template using following code:

    Workshop.ss

       <% if Dates %>
          <% control Dates %>
             <% if TotalItems == 1 %>
                <% if OtherDates %>
                   <% control OtherDates %>
                      <% if First %>
                         <dt>$TotalItems Termine</dt>
                      <% end_if %>
                   <% end_control %>
                <% else %
                   <dt>$TotalItems Termin</dt>
                <% end_if %>
             <% else %>
                <% if TotalItems == 1 %>
                   <dt>$TotalItems Termine</dt>
                <% else %>
                   <% if First %>
                      <dt>$TotalItems Termine</dt>
                   <% end_if %>
                <% end_if %>
             <% end_if %>
          <% end_control %>
       <% end_if %>

    When I enter an event from 08/24 up to 10/26, recurring every Monday, the code above results in a total of 8 times, which actually should result in a total of 10. This because I'm in the loop of OtherDates. Any idea on how to get the real amount of times, e.g. 10 ?

    Thanks in advance for any suggestion.

    mathiasmex

  • mathiasmex
    Avatar
    Community Member
    28 Posts

    Re: [Solved] EventCalendar OtherDates totals Link to this post

    Ok, found the solution:

    just included in WorkshopDateTime.php:

    public function TotalItemsCounter() {
       return ($this->iteratorTotalItems + 2);
    }

    and altered Workshop.ss as follows:

    <% if OtherDates %>
       <% control OtherDates %>
          <% if First %>
             <dt>$TotalItemsCounter Termine</dt>
          <% end_if %>
       <% end_control %>
    <% else %>
       <dt>$TotalItems Termin</dt>
    <% end_if %>

    Thanks to ssbits.

    mathiasmex

    813 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.