$page->hasDocuments()

Checks if there are any documents (pdf, doc, xls, etc.) in the page's directory

  • return (integer)

Example

<?php
echo $page->hasDocuments(); //returns the number of documents in the folder

if($page->hasDocuments()) {
  $documents = $page->documents();
}
?>

What is a document file?

Kirby considers the following file types as document:

  • text
  • mdown
  • md
  • markdown
  • pdf
  • doc
  • docx
  • dotx
  • word
  • xl
  • xls
  • xlsx
  • xltx
  • ppt
  • pptx
  • csv
  • rtf
  • rtx