Skip to content

Kirby 3.9.8

$page->hasDocuments()

Checks if the Files collection has any document files

$page->hasDocuments(): bool

Return type

bool

Parent class

Kirby\Cms\Page

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