$files->find()

Finds a single file or multiple files by one or many filenames.

  • return ($file | $files)

Example

Fetch a single file

<?= $page->files()->find('myfile.pdf')->url() ?>

Fetch multiple files

<ul>
  <?php foreach($page->files()->find('document-a.pdf', 'document-b.pdf', 'document-c.pdf') as $file): ?>
  <li>
    <a href="<?= $file->url() ?>">
      <?= html($file->filename()) ?>
    </a>
  </li>
  <?php endforeach ?>
</ul>