68 lines
2.5 KiB
PHP
68 lines
2.5 KiB
PHP
<?php
|
|
// -------------------------------------------
|
|
// kirby snippet FOR jannikbeyerstedt.de
|
|
|
|
// copyright: Jannik Beyerstedt | https://jannikbeyerstedt.de
|
|
// license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License
|
|
// -------------------------------------------
|
|
|
|
$subnav = false;
|
|
if ($page->depth() == 1) {
|
|
$baseSec = $page;
|
|
if ( $page->isVisible() && $baseSec->hasVisibleChildren() && $page->template() != 'blog' ) {
|
|
$subnav = true;
|
|
}
|
|
}else if ($page->depth() == 2) {
|
|
$baseSec = $page->parent();
|
|
if ( $page->isVisible() && $baseSec->hasVisibleChildren() && $page->template() != 'blogarticle' ) {
|
|
$subnav = true;
|
|
}
|
|
}
|
|
?>
|
|
|
|
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
<label class="hidden-sm-up" for="nav-trigger">Menü</label>
|
|
|
|
<nav class="mobile">
|
|
<ul class="nav mobileNav">
|
|
<li><a href="<?php echo $site->url()?>">Home</a></li>
|
|
<?php foreach ($site->children()->visible() as $p) : ?>
|
|
<li><a href="<?php echo $p->url()?>" <?php echo ($page == $p)?'class="active"':'' ?>><?php echo $p->title() ?></a></li>
|
|
<?php if ($p->hasVisibleChildren() && $p->template() != 'blog') : ?>
|
|
<ul class="">
|
|
<?php foreach ($p->children()->visible() as $c) : ?>
|
|
<li><a href="<?php echo $c->url()?>" <?php echo ($page == $c)?'class="active"':'' ?>><?php echo $c->title() ?></a></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</nav>
|
|
|
|
|
|
<div class="site-wrap">
|
|
<header class="section">
|
|
<div class="container">
|
|
<?php if ($img = $site->images()->find($site->title_image())) : ?>
|
|
<a class="logo" href="<?php echo url() ?>">
|
|
<img src="<?php echo $site->url().'/content/'.$site->title_image()->html() ?>" alt="Logo">
|
|
</a>
|
|
<?php endif; ?>
|
|
|
|
<nav aria-hidden="true">
|
|
<ul class="nav hidden-xs-down">
|
|
<?php if(!$subnav) : ?>
|
|
<?php foreach ($site->children()->visible() as $p) : ?>
|
|
<a href="<?php echo $p->url()?>" <?php echo ($page == $p || $page->parent() == $p)?'class="active"':'' ?>><li><?php echo $p->title() ?></li></a>
|
|
<?php endforeach; ?>
|
|
<?php else : ?>
|
|
<a href="<?php echo $baseSec->url()?>" class="section <?php echo ($page == $baseSec)?'active':'' ?>"><li><?php echo $baseSec->title() ?>:</li></a>
|
|
<?php foreach ($baseSec->children()->visible() as $p) : ?>
|
|
<a href="<?php echo $p->url()?>" <?php echo ($page == $p)?'class="active"':'' ?>><li><?php echo $p->title() ?></li></a>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</header>
|