Skip to content

Kirby 3.6.6

$page->hasCode()

Checks if the Files collection has any code files

$page->hasCode(): bool

Return type

bool

Parent class

Kirby\Cms\Page

Example

<?php
echo $page->hasCode(); //will echo 1 if true, nothing if false

if($page->hasCode()) {
  $codeFiles = $page->code();
}
?>

What is a code file?

Kirby considers the following file types as code:

  • js
  • css
  • scss
  • rb
  • xml
  • json
  • java

Any html or php files cannot be uploaded to pages for security reasons.