Ivan Gretsky Posted May 21, 2020 Share Posted May 21, 2020 Hello! I need to show pages with date range publish limitation. I mean each page has date_start and date_end fields, that, if populated, should determine, whether the page is considered "published" today. But none of those fields is mandatory. You can fill one or the other or both. I have written a selector with OR-groups like this: $selector = "SOME-CONDITION-HERE, "; $selector .= "range=(date_start='', date_end=''), "; $selector .= "range=(date_start='', date_end>=today), "; $selector .= "range=(date_start<=today, date_end>=today), "; $selector .= "range=(date_start<=today, date_end='')"; But is seems a little ugly and over-complicated. I thought maybe someone could propose a better solution? If not, let it be a working example of how to deal with this) Link to comment Share on other sites More sharing options...
AAD Web Team Posted May 22, 2020 Share Posted May 22, 2020 We've been doing basically the same thing but like this: $selector .= ", has_started=(start_date=''), has_started=(start_date<=today)"; $selector .= ", not_ended=(end_date=''), not_ended=(end_date>today)"; It seems to work ok. I don’t know of an easier way. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now