I'm sure this is something incredibly easy to do, but for some reason I can't get my head round it...
All I want to do is list back the latest 3 events from the Event Calendar module on the site homepage. Doesn't need anything fancy - just:
[Date] [Event/Announcement title] [Link to event] .... much as you would to bring back "latest news" headlines from a news section.
I'm the first to hold my hands up and say I'm not the greatest PHP-er in the world, but I think I'm probably over-complicating things here in looking for a solution. Either that or my brain is fried from deadlines and I can't see the wood for the trees...
Is there a function I can define in my HomePage.php that will enable me to do such a thing?
Is there any way of passing date filters to UpcomingEvents (or other built in functions) for pages away from the actual calendar template?
ie, I have a page template which lists a print ready version of Calendar Events in a specific format. What I really need to be able to do is start the page off (on first view) with all the currents months events, then let the user select which month they can print , either with calendarwidget or something like the MonthNavigator..
All of the key functions in the Calendar class are publicly accessible. You just have to make sure you get an instance first. Some of the most common functions are decorated into the SiteTree (e.g. UpcomingEvents()), which just automatically get a Calendar instance for you, based on URL segment, or most commonly, the only one you have in your SiteTree.
So you can write a custom function of your liking, and as long as you get something like: