Skip to content

Kirby 4.2.0


Returns the Files collection

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

Return type


Parent class



  <?php foreach($page->files() as $file): ?>
    <a href="<?= $file->url() ?>">
      <?= $file->filename() ?>
      (<?= $file->niceSize() ?>)
  <?php endforeach ?>

Note that the default sorting order of files is according to their order in the file system. To sort files by their manual sorting order, you can use $files->sortBy('sort'), where sort is the field that stores the sorting number if you manually sort files in the Panel.