Menu/submenu/projectmenu

Hi. Im trying to develop what I think is a simple site, but i must be getting the structure of things goofed up. I would like a menu bar that lists “projects, information, contact” then when project or information are clicked, below the menu line shows a sub menu of

Projects>Selected Projects, More Projects
Information>News, Introduction, People

and then when Selected Projects or More Projects are selected, below that second menu would show all the project names, which could be clicked to go to the project page, while also showing the teaser view of every project in either category. For information the sub menus would go directly to single pages for each.

I have structured my content as follows:

content/
   1-projects/
       1-selectedprojects/
             1-project-1/
             2-project-2/
             3-project-3/
             4-etc...
       2-moreprojects/
             1-project-1/
             2-project-2/
             3-project-3/
             4-etc...
   2-information/
            1-news/
            2-introduction/
            3-people/
   3-contact/
   error
   home

and my templates would then reflect that by having a structure like

site/
    templates/
        default.php
        home.php
        moreprojects.php
        project.php
        projects.php
        selectedprojects.php

Each project would simple just be text and images.
i can’t seem to get it to work this way though and I don’t really know which would be the problem to correct. i believe the individual templates are right. and my menu used to work when i just had individual projects within the project folder, but once i tried to have a sub menu, and then have each project show up as a clickable thing, as well as expand information to be a menu with options, nothing shows up anymore when i try this.

Here is a picture of the variety of ways it would look as you click through the menus:

right now though, all i get is this:

What is the code in the projects.php template? Without that we can only guess what’s wrong here.

Hi Lukas,

Thanks for your response. I didn’t know how much to put in the first post and I only cobble these things together so Im not aware of everything that is important. Here is the code in the projects.php template:

<?php snippet('header') ?>

  <main class="main" role="main">
<?php

$items = false;

// get the open item on the first level
if($root = $pages->findOpen()) {

  // get visible children for the root item
  $items = $root->children()->visible();
}

// only show the menu if items are available
if($items and $items->count()):

?>
<nav>
  <ul>
    <?php foreach($items as $item): ?>
<a<?php e($item->isOpen(), ' class="active"') ?> href="<?php echo $item->url() ?>"><?php echo $item->title()->html() ?></a>,
    <?php endforeach ?>
  </ul>
</nav>
<?php endif ?>

    <div class="text">

      <?php echo $page->text()->kirbytext() ?>
    </div>

    <hr>

    <?php snippet('projects') ?>

  </main>

<?php snippet('footer') ?>

It looks like $items is still false, so no projects are displayed. It can’t be a PHP error since the footer is displayed again.

Since the projects template is only used for the projects page anyway, can’t you just use $page instead of $root?

thanks. that didnt help, but i can’t imagine this is a tricky concept, so I’m sure i goofed somewhere small and i going to try and just rebuild the entire structure. i was modifying from the starter kit to get here and that was prob a silly thing to do. but it took me a bit to get a better mental concept for how this should be coded and organized.

And while you’re at it, think about including the submenu into you nav snippet, so you don’t have to include the code into every template. Or - if that is not possible in your layout - create a separate snippet that you can include in every template where you need it.