Hi everyone, I'm wondering what the best way to sort a page by date is. I have a few pages that render a list of pages based on specific criteria, e.g. template. I want to provide 2 date pickers on each of those pages to allow users to search by date range on that specific page. I'm wondering what the best way to go about it is.
The date has formatting attached to it. I'm wondering if I should use the unformatted version instead of the formatted one. Would this make it easier to work with in this situation?
I was thinking of using jQuery UI datepickers and a button to submit the form and apply the date range filter to the results that are rendered on the page.
if($page->id == 1) {
$events = $pages->get("name=event")->children;
} else if($page->name == 'users') {
$events = $pages->find("created_users_id=$username, template=log-item");
} else {
$sort_type = $page->template;
$events = $pages->find("$sort_type=$page");
}
if(count($events)) {
foreach($events as $event) {
// ...
}
}
The date I will be working with has been stored in the $page->date_start field. Currently it is formatted using ProcessWire's options.
I'm wondering what the best way to tie date filtering functionality into the above query would be, if even possible, and if not, which way should I go about doing it?
Thanks!





Find content
Female
