dai
1
When adding an isOpen or isActive to a subpage menu item in a menu, I get a PHP error.
Nesting level too deep - recursive dependency? in …/kirby/core/page.php on line 757
isOpen or isActive works on the root level menu items. I have removed the code to get my site working in the meantime.
Any thoughts?
Using Kirby 2.0.6.
Using multi-language site
dai
2
Took the isActive/isOpen out of the foreach loop.
old
foreach($items as $p) …
$p->isActive()
changed to
foreach($items as $p) …
$page->isActive()
Appears to be working.
Are you referring to your own code or is the core code or any documentation wrong?
dai
4
I had a custom menu that included root links and one subpage link.
$items = $pages->find('link1', 'link2', 'link2/link2.1' );
if($items && $items->count() > 0):
$n = 0;foreach($items as $p): $n++;
<li class="<?php echo ($n%2) ? 'left' : 'right' ?>"><a<?php echo ($p->isActive()) ? ' class="active"' : '' ?> href="<?php echo $p->url() ?>">
<?php echo html($p->title()) ?></a></li>
<?php endforeach ?>
<?php endif ?>
When the menu generated the isActive for link2/link2.1, i would get
Fatal error: Nesting level too deep - recursive dependency? in <b>../kirby/core/page.php</b> on line <b>757</b>
I ended up pulling the subpage out of the loop and added it after the menu.I did a check for the slug to get it to work.
<li class="right"><?php $c = $pages->children()->findBy('uid', 'link2.1'); ?><a
<?php if ($page->slug() == 'link2.1') { echo 'class="active"'; } ?>
href="<?php echo $c->url() ?>"> <?php echo html($c->title()) ?></a></li>