Making Automatic Navigation System #122
taufik-nurrohman
started this conversation in
Ideas
Replies: 1 comment
-
To add submenu feature: ---
title: Store
description: Download custom extension and layout for free and for a small fee.
menus:
'/store/extension/1': Extension
'/store/layout/1': Layout
...
Content goes here. <ul>
<?php foreach ($links as $link): ?>
<li>
<a href="<?= $link->url; ?>">
<?= $link->title; ?>
</a>
<?php if ($menus = $link->menus): ?>
<ul>
<?php foreach ($menus as $k => $v): ?>
<li>
<a href="<?= $k; ?>">
<?= $v; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What I do in almost all Mecha’s layout system is to make a variable named
$links
in which it contains the data of the root page objects to be applied as navigation menu somewhere in the layout files.In
.\lot\y\*\index.php
file, I do this:In
.\lot\y\*\nav.php
file, then I can print out the$links
variable as navigation items:Current state can be added dynamically via
$page->__set()
method and the like, to add custom page properties within the loop:You can also utilize every internal properties added to the page file itself, for example, to control the navigation link visibility:
Beta Was this translation helpful? Give feedback.
All reactions