Skip to content

Kirby 3.7.5

$page->code()

Filters the Files collection by type code

$page->code(): Kirby\Cms\Files

Return type

Kirby\Cms\Files

Parent class

Kirby\Cms\Page

Example

<?php foreach($page->code()->filterBy('extension', 'css') as $css): ?>
<?= css($css->url()) ?>
<?php endforeach ?>

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.