private function highlightElement($indexArray, $menuArray = null, $nr = 0) { //index to get $i = $indexArray[$nr]; //if menu is null take menuArray if ($menuArray == null) { $menuArray = $this->menuArray; } //create itterator $iter = new RecursiveArrayIterator($menuArray); //move to current index $iter->seek($i); //move down until we have found the element - then set the css-class for that element if (is_array($iter->current())) { $this->highlightElement($indexArray, $iter->getChildren(), $nr + 1); } else { $iter->current()->cssClass = $this->cssClass; } }