0

I've got a website filled with events. Some events have a start date, others don't. I sort my events by date on the frontpage so the event closest into the future shows up first.

But their are some events with no dates. These kind of events take more than one day/week/month/... so it doesn't make sense to add a (single) date.

How can I make a list, by using views, where the dates with a date show up on top and those without close the list by showing up at the end of the page.

Any suggestions on filters or work-arounds where I can specify this kind of sorting criteria?

  • Have you tried rules? You could have rules look for a date and trigger it to trigger it to check the "publish to frontpage" checkbox and then create a rule to remove the checkbox after a certain time frame. – chrisjlee Mar 5 '12 at 17:34
2

I haven't tested this, but I would make two views-- View A includes the events with a start date and View B includes the events with no dates. Then, add View B as the footer to View A. The events will now be shown on the bottom.

  • This is just brilliant in it's simplicity! Thanks a million! – Michiel Mar 6 '12 at 8:42
0

I recommend creating your own Views filter handler that checks whether the date is set. You can place this filter above the existing date filter so that results are first sorted by whether the date is set and then filtered by the date, if any.

Creating a Views filter handler isn't for the faint of heart. It involves implementing Views API hooks and writing a custom class that extends views_handler_filter.

You can get a better idea of what's involved here, but the article is regarding Views 2, not Views 3. Full Views 3 API documentation is viewable on your site via the Advanced Help module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.