Jump to:

10990 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » Event Calendar Module - How to Question

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 1736 Views
  • Bstarr
    Avatar
    Community Member
    25 Posts

    Event Calendar Module - How to Question Link to this post

    Is there a way to show the next two events on another page besides the main events page? I have a space on my home page for upcoming events and if possible I'd like this to show the next two events as opposed to me having to update that page manually myself. Is there a way to do this?

    I'm not a developer, so writing scripts isn't an option for me. I'm just wondering if there is a fairly simple way to achieve this. Any help you can provide is greatly appreciated.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar Module - How to Question Link to this post

    <% control UpcomingEvents %>

  • IDOLYZ
    Avatar
    Community Member
    40 Posts

    Re: Event Calendar Module - How to Question Link to this post

    Hi UncleCheese,

    I have a similar problem. I can get the next upcoming event to show, however when I added 2 more calendars to my site, it isn't showing the next upcoming event anymore. This is my function code:

    return DataObject::get_one("Calendar")->upcomingEvents(1);

    How can I specify a parent ID to the above?

    I tried this:

    $event = DataObject::get_one("Calendar");
    return ($event) ? DataObject::get("CalendarEvent", "ParentID=16", "", "", 1) : false;

    But it shows past events.

    Any help would be greatly appreciated.

    Cheers,
    Ben

  • Bstarr
    Avatar
    Community Member
    25 Posts

    Re: Event Calendar Module - How to Question Link to this post

    I think I'm still missing what to do with that line of code. I added it in but it isn't working and the WYSIWYG Editor actually strips out the "<" and ">". What am I doing wrong?

    <td width="290px">
    <h2>News &amp; Events</h2>
    <table id="News &amp; Events Table" style="width: 100%;" border="0">
    <tbody>
    <tr valign="top">
    <td><% control UpcomingEvents %></td>
    </tr>
    <tr valign="top">
    <td>
    <p><a class="link" href="[sitetree_link id=16]">view other events</a></p>
    </td>
    </tr>
    </tbody>
    </table>
    </td>

  • IDOLYZ
    Avatar
    Community Member
    40 Posts

    Re: Event Calendar Module - How to Question Link to this post

    You need to add it to your Page.SS file (or whichever page type it is).

  • Bstarr
    Avatar
    Community Member
    25 Posts

    Re: Event Calendar Module - How to Question Link to this post

    Thanks, so there is no way to have it just on that one page? I don't want it everywhere there is a cell in a table that is supposed to show the next two events that appears only on the home page.

  • IDOLYZ
    Avatar
    Community Member
    40 Posts

    Re: Event Calendar Module - How to Question Link to this post

    Yes, you could either create a new template for the home page. See: http://doc.silverstripe.org/sapphire/en/tutorials/1-building-a-basic-site

    Or you could put an if statement, like this:

    <% if Page(home) %>
    <table id="News &amp; Events Table" style="width: 100%;" border="0">
    <tbody>
       <% control UpcomingEvents %>
          <tr>
             <td>$Event.CalendarEventImage
             <h3><a href="$Event.Link">$Event.Title</a></h3>
             <h4>$_Dates</h4>
             $Event.Content</td>
          </tr>
       <% end_control %>
    </tbody>
    </table>
    <% end_if %>

    The above is untested...

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar Module - How to Question Link to this post

    Its much better to make a custom page type. If you're putting structural markup in the wysiwyg editor, you've really missed the whole point of silverstripe, and you need to read the tutorial above.

    1736 Views
Page: 1 2
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.