function markSelected(&$menuItems) { $selectedItems = 0; $uri = Request::path(); foreach ($menuItems as &$menuItem) { $selectedChildren = 0; if ($uri == trim($menuItem['href'], "/")) { $menuItem['class'] = 'selected'; $menuItem['open'] = true; $selectedItems++; } if (isset($menuItem['sub_menu'])) { if (!empty($menuItem['sub_menu'])) { $selectedChildren += markSelected($menuItem['sub_menu']); } } if ($selectedChildren > 0) { $menuItem['class'] = 'child-selected'; $menuItem['open'] = true; } $selectedItems += $selectedChildren; } return $selectedItems; }
} </script> </head> <body> <div id="wrap"> <div id="header"> <form action="#" method="post"> <input type="text" name="search"> <input type="submit" value="keres"> </form> </div> <header> <nav id="headerNav"> <ul> <li <?php markSelected("index", $baseName); ?> ><a href="index.php">home</a></li> <li <?php markSelected("about", $baseName); ?> ><a href="about.php">about me</a></li> <li <?php markSelected("contact", $baseName); ?> ><a href="contact.php">contact</a></li> </ul> </nav> </header> <div id="wrapper">
markSelected("cssSelectors", $baseName); ?> ><a href="cssSelectors.php">selectors</a></li> <li<?php markSelected("cssFontFace", $baseName); ?> ><a href="cssFontFace.php">fontFaces</a></li> <li<?php markSelected("sbox", $baseName); ?> ><a href="sbox.php">sandBox</a></li> </ul> </li> <li<?php markSelected("articleHtml5", $baseName); ?> ><a href="articleHtml5.php">html5</a></li> </ul> </div> <br> <div> <h1>stickyNotes</h1> <div id="scribble" contenteditable="true" onkeyup="storeUserScribble(this.id);"></div> <p><a id="c-link" href='' onclick='clearLocal();'>Clear local storage</a></p> <script> getUserScribble();