Hi Perch Community!
I am currently building a site for a local magazine and we would like to have a page with all the previous issues on - all 15 years worth!
I'm adding the previous issues into a collection so I can also include them around the rest of the site too, specially the latest issue. But for the previous issues page I was wondering if there was a way to dynamically divided up the issues by year using just one perch_collection() rather than having one for each year, and then of course having to remember to add a new one each year.
So far I have...
PHP
- <?php
- perch_collection('Previous Issues', [
- 'template' => 'previous_issues.html',
- 'sort' => 'issueDate',
- 'sort-order' => 'ASC',
- 'filter'=>'issueDate',
- 'match'=>'eqbetween',
- 'value'=> '2020-01-01, 2020-12-31',
- 'data' => [
- 'thisYear' => '2020'
- ],
- ]);
- perch_collection('Previous Issues', [
- 'template' => 'previous_issues.html',
- 'sort' => 'issueDate',
- 'sort-order' => 'ASC',
- 'filter'=>'issueDate',
- 'match'=>'eqbetween',
- 'value'=> '2019-01-01, 2019-12-31',
- 'data' => [
- 'thisYear' => '2019'
- ],
- ]);
- perch_collection('Previous Issues', [
- 'template' => 'previous_issues.html',
- 'sort' => 'issueDate',
- 'sort-order' => 'ASC',
- 'filter'=>'issueDate',
- 'match'=>'eqbetween',
- 'value'=> '2018-01-01, 2018-12-31',
- 'data' => [
- 'thisYear' => '2018'
- ],
- ]);
...etc.
Many thanks for your help
Glen