4

I'm trying to return results based on a year stored in a custom field. For example, returning entries with a model year greater than 2006 and less than 2009. Is there a search syntax to support this?

For example: for entry in craft.entries.section('equipment').search(modelYear: > 2006 && < 2009) …

Kyle
  • 367
  • 1
  • 6

1 Answers1

5

You can do a certain amount of logic in the ElementCriteriaModel syntax. I think this will work:

{% set entries = craft.entries.section('equipment').modelYear('and, > 2006, < 2009') %}
{% for entry in entries %}
  ...
{% endfor %}
Marion Newlevant
  • 12,047
  • 22
  • 55