Site level too deep - path problem

Hello there!

I have a sitemap like this:
Home
News - About - Past events - Partners - Contact
Under Past events is: 2015 - 2014
And under each past events are multiple articles.

so - 4 levels

The problem is:
The articles don’t get the paths in the menu snippet right. To access the logo i have to add “…/” to the path and to the index link on the logo. I think you get the problem. I had to have a second menu-articles snippet, but this does not seem right. also the css for the header is not right then.

I hope that someone can help!

here is the menu.php snippet - with works fine for level 1, 2 and 3, but not for the 4th

<div class="navbar-fixed">
  <navi>
     <div class="nav-wrapper">
       <a href="index.php" class="brand-logo"><img src="content/tedxtum.png" style="height: 65px;"></a>
       <a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
       <ul class="right hide-on-med-and-down">
         <?php foreach($pages->visible() as $p): ?>
           <li><a <?php e($p->isOpen(), ' class="selected"') ?> href="<?php echo $p->url() ?>"><?php echo $p->title()->html() ?></a></li>
         <?php endforeach ?>
       </ul>
       <ul class="side-nav" id="mobile-demo">
         <?php foreach($pages->visible() as $p): ?>
           <li><a <?php e($p->isOpen(), ' class="selected"') ?> href="<?php echo $p->url() ?>"><?php echo $p->title()->html() ?></a></li>
         <?php endforeach ?>
       </ul>
     </div>
   </navi>
</div>

Thank you so much!

I don’t quite get what you want to achieve, a tree like menu? $pages only fetches the pages on the first level, not any subpages. Have a look at the docs.

As regards the CSS, use the css() helper:

<?= css('assets/css/app.css') ?>

That way you make sure that the path to the css file is always right.

As regards the logo

<a href="<?= $site->url() ?>" class="brand-logo"><img src="<?= $site->image('tedxtum.png')->url() ?>" style="height: 65px;"></a>

Thank you for the fast response!

The problem is, that the article.php template does get the header & footer snippet but then the paths are not right, because the sites that have the article template are too deep in the structure (on the 4th level)

Yes, but if you do it the way I suggested above for the css and the logo, the path is always correct now matter how deep a page is listed in the tree.

Ok, the CSS works fine! Thanks for that!
But if I use the suggested logo code, my site breaks completely. nothing is shown anymore.

I get this message in the source code:

<a href="http://localhost/testing" class="brand-logo"><img src="<br />
<b>Notice</b>:  Use of undefined constant tedxtum - assumed 'tedxtum' in <b>C:\xampp\htdocs\testing\site\snippets\menu.php</b> on line <b>5</b><br />
<br />
<b>Notice</b>:  Use of undefined constant png - assumed 'png' in <b>C:\xampp\htdocs\testing\site\snippets\menu.php</b> on line <b>5</b><br />
<br />
<b>Fatal error</b>:  Call to a member function url() on null in <b>C:\xampp\htdocs\testing\site\snippets\menu.php</b> on line <b>5</b><br />

Oh, sorry, there should of course be quotes around the filename:

<a href="<?= $site->url() ?>" class="brand-logo"><img src="<?= $site->image('tedxtum.png')->url() ?>" style="height: 65px;"></a>

Yey! It works! Thank you so much!!