I have a problem:
I have a page on which subpages from another page are also displayed or pages can be assigned in the backend. However, if an assigned subpage no longer exists, I get the following error:
Call to a member function url() on null
The associated code is:
<?php foreach($page->produktionen()->split() as $item) : ?>
<?php $item = str_replace("_","-",$item) ?>
<a class="col-lg-4 col-xs-12 card cardFull" href="<?= page($item)->url() ?>">
<div class="card_image">
<?php if ($image = page($item)->cover()->toFile()) : ?>
<img alt="" src="<?= $image->url() ?>" alt=""/>
<?php endif ?>
</div>
<div class="card_overlay"></div>
<div class="card_heading">
<span class="small"><?php e($kirby->language() == "de", 'Produktionen', 'Productions') ?></span>
<h3><?= page($item)->title() ?></h3>
</div>
</a>
<?php endforeach ?>