Jump to:

10994 Posts in 2728 Topics by 1819 members

All other Modules

SilverStripe Forums » All other Modules » Event Calendar Widget on Home page

Discuss all other Modules here.

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

Page: 1 2 3 4 5
Go to End
Author Topic: 6448 Views
  • elgordo
    Avatar
    Community Member
    70 Posts

    Re: Event Calendar Widget on Home page Link to this post

    Thanks for the info - resolved the issue I was having in getting a global calendar showing

  • tchintchie
    Avatar
    Community Member
    63 Posts

    Re: Event Calendar Widget on Home page Link to this post

    Hello all!

    I´m running a site for our small travel agency so I thought it would be nice to have the upcoming events posted on the HomePage. The calendar works fine on it´s calendarpage but how do I get it to work on the HomePage? I followed your little tutorial here and it got me the calendar widget which isn´t what i want.
    Is there a possibility to e.g. post 5 upcoming events (without the calendar widget) on my HomePage? Can someone give me the codes for the HomePage.php and HomePage.ss ???

    many thanks in advance
    kind regards
    tchintchie

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar Widget on Home page Link to this post

    <% control UpcomingEvents%>
    $_Dates $EventTitle $Link
    <% end_control%>

  • tchintchie
    Avatar
    Community Member
    63 Posts

    Re: Event Calendar Widget on Home page Link to this post

    UncleCheese, thanks for the code. But obviously it´s not enough to just simply paste it into my HomePage.ss ?? Is there something else I need to add to my HomePage.php? here´s what it looks like at the moment:

    <?php
    /**
    * Defines the HomePage page type
    */
    class HomePage extends Page {
    static $db = array(
    );
    static $has_one = array(
    );
    function LatestNews($num=5) {
    $news = DataObject::get_one("ArticleHolder");
    return ($news) ? DataObject::get("ArticlePage", "ParentID = $news->ID", "Date DESC", "", $num) : false;
    }
    static $icon = "themes/tutorial/images/treeicons/home";
    }
    class HomePage_Controller extends Page_Controller {
       function GlobalCalendarWidget()
    {
    $calendarPage = DataObject::get_one("Calendar"); // If you have multiple calendars, specify an id or url segment.
    return new CalendarWidget($calendarPage);
    }
    function UpcomingEvents()
    {
    return DataObject::get_one("Calendar")->upcomingEvents(5);
    }
    }

    sorry for being a noob :-/

    thanks in advance!

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar Widget on Home page Link to this post

    No, that function is decorated into your SiteTree class, so you don't need to write any code. It's added automatically by the module.

  • tchintchie
    Avatar
    Community Member
    63 Posts

    Re: Event Calendar Widget on Home page Link to this post

    *sigh* thanks so much for the quick reply and your patience...however I really meant it when I said "noob" :-D Ok, so I decorated the above mentioned functions of the calendar-code to my SiteTree.php (so far so good?)
    I did a dev/build --> nothing happened. Added
    <% control UpcomingEvents%>
    $_Dates $EventTitle $Link
    <% end_control%>
    to my HomePage.ss and ran a dev/build again. Still nothing.
    I really feel bad about bothering you with my noob-problems but it would be such a nice feature. But it seems I need a step-by-step tutorial on that. Anyone has pity on me??

    thanks again

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar Widget on Home page Link to this post

    No, you shouldn't have to do any decorating. The module does it for you. That control block should work out of the box.

  • tchintchie
    Avatar
    Community Member
    63 Posts

    Re: Event Calendar Widget on Home page Link to this post

    alright, found another (older) post where someone intented to do the same. I even got the upcoming events working on my homepage BUT...when I click on the event link it gives me the error page. I´ve read that this issue was supposed to be fixed with a SVN update but since I just recently downloaded that module I don´t think there´s a newer version? btw those posts where from 2009 ... :-/ maybe not compatible with SS 2.4.5??

    6448 Views
Page: 1 2 3 4 5
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.