<?php
$NavMenu = [
'The Green' =>
[
'name' => 'The Green',
'subname' => 'Nice Color',
'href' => 'greenlink',
'title' => 'green is nature',
'icon' => 'globe',
'class' => 'green',
'subnav' => ''
],
'The Sun' =>
[
'name' => 'The Sun',
'subname' => 'hot color',
'href' => 'yellowlink',
'title' => 'yellow is sun',
'icon' => 'sunicon',
'class' => 'yellow',
'subnav' => ''
],
'The Sky' =>
[
'name' => 'The Sky',
'subname' => 'freedom',
'href' => 'bluelink',
'title' => 'blue is cold',
'icon' => 'free',
'class' => 'yellow',
'subnav' =>
[
'name' => 'Free',
'href' => 'bluelinkFree',
'title' => 'freedom is love',
'class' => 'blueFreedom',
'icon' => 'love',
'subname' => 'love'
]
]
];
echo "<ul>";
foreach ($NavMenu as $navItem) {
echo sprintf(
'<li><a class="%s" href="%s" title="%s"><span icon="%s"></span>%s - %s</a>',
$navItem["class"],
$navItem["href"],
$navItem["title"],
$navItem["icon"],
$navItem["name"],
$navItem["subname"]
);
if (is_array($navItem["subnav"])) {
$subNavItem = $navItem["subnav"];
echo sprintf(
'<ul><li><a class="%s" href="%s" title="%s"><span icon="%s"></span>%s - %s</a></li></ul>',
$subNavItem["class"],
$subNavItem["href"],
$subNavItem["title"],
$subNavItem["icon"],
$subNavItem["name"],
$subNavItem["subname"]
);
}
echo "</li>";
}
echo "</ul>";
- Output for 7.1.25 - 7.1.28, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- <ul><li><a class="green" href="greenlink" title="green is nature"><span icon="globe"></span>The Green - Nice Color</a></li><li><a class="yellow" href="yellowlink" title="yellow is sun"><span icon="sunicon"></span>The Sun - hot color</a></li><li><a class="yellow" href="bluelink" title="blue is cold"><span icon="free"></span>The Sky - freedom</a><ul><li><a class="blueFreedom" href="bluelinkFree" title="freedom is love"><span icon="love"></span>Free - love</a></li></ul></li></ul>
preferences:
148.38 ms | 409 KiB | 5 Q