Show a calculated range of pages



is ist possible to show a calculated range of pages?

I have a page with a field called “year”. I need to display all pages with the same year +/- 10 years.

I already managed it to display pages with the same year with the following line:

<?php $werke = page('bibliothek/werke')->children()->filterBy('year',$page->year()->uri());?>


Yes, you can do that with a filter with a callback

More date based examples here:


almost there…

but with this i get no results:

<?php $werke = page('bibliothek/werke')->children()->filterBy('year', '>', strtotime('year - 10'))->filterBy('year', '<', strtotime('year + 10'));?>

(i have set the field as number)


That doesn’t make sense