Comments (2)
You can simply loop through any children, If you have set the dropdown limit in the blueprint to allow that level of nested children then its as simple as this.
<div id="responsive-menu">
<div class="top-bar">
<ul class="dropdown vertical medium-horizontal menu" data-responsive-menu="drilldown medium-dropdown" data-auto-height="true" data-animate-height="true">
<?php foreach($site->mainnavigation()->toStructure() as $navigation): ?>
<li><a aria-label="<?php echo $navigation->text() ?>" href="<?php echo $navigation->url(); ?>"><?php echo $navigation->text() ?></a>
<?php if($navigation->children()->isNotEmpty()): ?>
<ul class="menu vertical nested">
<?php foreach($navigation->children()->toStructure() as $children): ?>
<li><a aria-label="<?php echo $children->text() ?>" href="<?php echo $children->url() ?>"><?php echo $children->text() ?></a>
<?php if($children->children()->isNotEmpty()): ?>
<ul>
<?php foreach($children->toStructure() as $subchildren): ?>
<li><a aria-label="<?php echo $subchildren->text() ?>" href="<?php echo $subchildren->url() ?>"><?php echo $subchildren->text() ?></a></li>
<?php endforeach ?>
</ul>
<?php endif ?>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
</li>
<?php endforeach ?>
</ul>
</div>
from kirby-navigation.
Thanks, Chris
All working now.
I did have an issue and modified your code to suit, here's what I finished up with:-
<div id="responsive-menu">
<div class="top-bar">
<ul class="dropdown vertical medium-horizontal menu" data-responsive-menu="drilldown medium-dropdown"
data-auto-height="true" data-animate-height="true">
<?php foreach($site->mainnavigation()->toStructure() as $navigation): ?>
<li><a aria-label="<?php echo $navigation->text() ?>" href="<?php echo $navigation->url(); ?>"><?php echo $navigation->text() ?></a>
<?php if($navigation->children()->isNotEmpty()): ?>
<ul class="menu vertical nested">
<?php foreach($navigation->children()->toStructure() as $children): ?>
<li><a aria-label="<?php echo $children->text() ?>" href="<?php echo $children->url() ?>"><?php echo $children->text() ?></a>
<?php if($children->children()->isNotEmpty()): ?>
<ul class="menu vertical nested">
<?php foreach($children->children()->toStructure() as $subchildren): ?>
<li><a aria-label="<?php echo $subchildren->text() ?>" href="<?php echo $subchildren->url() ?>"><?php echo $subchildren->text() ?></a></li>
<?php endforeach ?>
</ul>
<?php endif ?>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
</li>
<?php endforeach ?>
</ul>
</div>
</div>
from kirby-navigation.
Related Issues (20)
- Missing translations HOT 1
- Use `panel.plugin({use: VueNestable})` HOT 1
- Add `depth` to each node
- Composer install doesn't work HOT 18
- Relative Links and Multi Lang Menus HOT 2
- Would Multiple Menus Be Possible? HOT 2
- Aria-current ? HOT 6
- Use page id on Kirby links instead absolute url HOT 4
- Make open/close more easy Double click to open and close menu item HOT 1
- Navigation Items appear blank with Kirby 3.6 HOT 2
- Plugin is not working with kirby 3.6 HOT 3
- Does it support different menus in different languages? HOT 1
- Highlight active menu item HOT 1
- Navigation entries cannot be removed and are not displaying page/entry title/text? HOT 1
- Kirby 3.7 issue HOT 1
- UI/UX Improvement Suggestion
- Info on how to require this package using composer? HOT 2
- Target for custom links
- Implementing Kirby4 Link-Field
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kirby-navigation.