We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum
Conditional output in templates based on date?
I'm trying to customise search results at the template stage. What I'd like to achieve is for the result to only appear if a date field in the result is less than or equal to the current date.
I'm passing in the current date from search.php like this:
And I'm using Perch:if statements to try and control the display of the results like this (where item_post_date is a date formatted in Y-m-d):
<perch:if id="item_post_date" match="lte" value="current-date"> ... item output code here <perch:else> <p>Item not yet published </perch:if>
The problem is, the item is always displayed. Is it actually possible to compare these two variables in the template this way, or do I need to use an alternative date format?
Want to reply to this thread?Login with Perch