Skip to content

Kirby 3.7.5

$page->depth()

Returns a number indicating how deep the page is nested within the content folder

$page->depth(): int

Return type

int

Parent class

Kirby\Cms\Page

Example

<select onchange="window.location.href = this.value">
<?php foreach($site->index() as $p): ?>
<option value="<?= $p->url() ?>">
  <?= str_repeat('-', $p->depth()) ?>
  <?= html($p->title()) ?>
</option>
<?php endforeach ?>
</select>