10387 Posts in 2198 Topics by 1712 members
| Go to End | Next > | |
| Author | Topic: | 5030 Views |
-
Calendar event module - upcoming events on homepage?

16 March 2009 at 4:51am Last edited: 16 March 2009 4:52am
Hi
Its fireme asking for help again lol, Ok i have the calendar event module and would like to have next 5 upcoming event on the home page. the same as i got the top 5 latest news articles. But as im not a php guru, i dont know how to do it. So as you are all very nice and helpful i thought i would ask here.
Thanks in advance
FireMe!
-
Re: Calendar event module - upcoming events on homepage?

16 March 2009 at 6:44am
$myCalendar->upcomingEvents(5);
-
Re: Calendar event module - upcoming events on homepage?

16 March 2009 at 6:51am
where would i put this?
-
Re: Calendar event module - upcoming events on homepage?

16 March 2009 at 6:58am
In your homepage controller.
function UpcomingEvents()
{
return DataObject::get_one("Calendar")->upcomingEvents(5);
}<% control UpcomingEvents %>
<h3>$_Dates</h3>
<h4><a href=$Event.Link">$Event.Title</a></h4>
<% end_control %> -
Re: Calendar event module - upcoming events on homepage?

16 March 2009 at 7:16am
Thanks that worked great, is there also a way if the latest event is in the past to still display as upcoming?, see i dont want a blank part of the home page if there is no upcoming events. if you get what i mean??
Thanks in advance
-
Re: Calendar event module - upcoming events on homepage?

16 March 2009 at 7:21am
There should be a recentEvents() function, as well. Try it. If not, I'll add it in.
Also, FYI, the second argument of those functions is a filter in case you want to do something like upcomingEvents(5, "Category = 'Blah')
-
Re: Calendar event module - upcoming events on homepage?

16 March 2009 at 7:41am
i tried the following but didn't seem to work.
function RecentEvents()
{
return DataObject::get_one("Calendar")->RecentEvents(5);
}also i am trying to format the date, the same as i did for my latest news
<div class="month">$Date.Format(M)</div>
<div class="day">$Date.Format(d)</div>
i have tried
<div class="month">$_Dates.Format(M)</div>
<div class="day">$_Dates.Format(d)</div>
but does not work and i get
Fatal error: Call to a member function XML_val() on a non-object
-
Re: Calendar event module - upcoming events on homepage?

16 March 2009 at 8:05am
$StartDate and $EndDate are the properties you're looking for. $_Dates is a magic method that returns a human readable date range (e.g. October 10-20, 2009) in microformat compliant markup.
| 5030 Views | ||
| Go to Top | Next > |

