Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

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

Nesting an IF in a control

Go to End

3 Posts   1272 Views


Community Member, 4 Posts

22 February 2009 at 1:10pm

Is it possible to use a conditional if to check a date, such as:

  <% control Children %>
     <% if EventDate > Now %>
     <% end_if %>
  <% end_control %>

Embargo/Expiry doesn't seem to limit my list of events (even logged out), so I need to filter them another way.


Forum Moderator, 5521 Posts

23 February 2009 at 2:07pm

the template parser is basic, you can't do comparisons between 2 variables. You will have to add a function to your Event then check on that

function ShowEvent() {
return ($this->EventDate > date('Y-m-d')) ? true : false;

then in your template use <% if ShowEvent %>


Community Member, 4 Posts

23 February 2009 at 9:18pm