What’s the best way to create a collection of all pages using the template “factory”?
Something like:
<?php $collection = page("factory"); ?>
<?php foreach ($collection as $factory): ?>
...
<?php endforeach ?>
What’s the best way to create a collection of all pages using the template “factory”?
Something like:
<?php $collection = page("factory"); ?>
<?php foreach ($collection as $factory): ?>
...
<?php endforeach ?>
You can just use “filterBy”:
$collection = $site->index()->filterBy('template','factory');
Best,
Thomas
@thguenther is right, but if there is a way to narrow it down to the descendants of a particular page, I’d prefer that to going through the complete site index.