Skip to content

Kirby 4.5.0

$pages->files()

Returns all files of all children

$pages->files(): Kirby\Cms\Files

Return type

Kirby\Cms\Files

Parent class

Kirby\Cms\Pages

Examples

<?php foreach($pages->files() as $file): ?>
  <img src="<?= $file->url() ?>">
<?php endforeach ?>

To only get files of a certain type, you can filter by type, e.g.

$pages->files()->filterBy('type', 'image');
$pages->files()->filterBy('type', 'video');