Hello,
I have a blueprint call Reports. You can upload PDF files to each report under the “Files” section.
In my Reports template file, how can I list all the files updated to the report?
Thanks!
Hello,
I have a blueprint call Reports. You can upload PDF files to each report under the “Files” section.
In my Reports template file, how can I list all the files updated to the report?
Thanks!
If you don’t have any other files, you can get them like this:
<?php
//get all files
$files = $page->files();
foreach($files as $file):
?>
<a href="<?= $file->url() ?>" ><?= $file->filename() ?></a>
<?php endforeach ?>
If you want to filter them first:
<?php
$files = $page->files()->filterBy('extension', 'pdf');
...
?>
Great, that’s awesome, thanks!!