Hi, I'm trying to use something like
<% if InFuture(EndDate) %> or <% if EndDate.InFuture %>
inside a control to get the next few events to put on a home page.
The control is calling upcoming events, which are defined by this function:
function UpcomingEvents($num=3) {
return DataObject::get("EventObject", "", "StartDate DESC", "", $num);
}
Nothing works.
If I put $Now outside my <% control %> block I get today's date, but anywhere inside it I get nothing. I have come to the conclusion that today's date is just not available to use within my control, which means that I can't use it to tell whether or not things are in the future.
My control is running through objects, not pages.
What I think I might have to do is incorporate it into the function up there^ but my function writing skills are minimal and I don't know how. I need to put in a filter I think.
Any help would be much appreciated.
Edit: I think I've found it. This post was very helpful - don't know why I couldn't find it before http://www.silverstripe.org/data-model-questions/show/12646