Hello, I have a two level submenu that looks something like this: [code] <ul> <li><a href="/main-dir/subdir1/>1st Item</a></li> <li><a href="/main-dir/subdir2/>2nd Item</a> <ul> <li><a href="/main-dir/subdir2/a.php>1st SubItem</a> <li><a href="/main-dir/subdir2/b.php>2nd SubItem</a> <li><a href="/main-dir/subdir2/c.php>3rd SubItem</a> </ul> </li> <li><a href="/main-dir/subdir3/>3rt Item</a></li> <li><a href="/main-dir/subdir4/>4th Item</a></li> </ul> [/code] I am indicating the active page by giving the relevant <li> a class of "active" The tricky part is that, in the case of SubItems I would like the parent <li> to have a class of "active" as well as the actual active page <li>. I have some code that is working on the main menu: [code] //Menu is $menu $lines = split("\n", $menu); foreach ($lines as $line) { $current = false; preg_match('/href="([^"]+)"/', $line, $url); if (substr($_SERVER["PHP_SELF"], 0, 5) == substr($url[1], 0, 5)) { $line = str_replace('<a h', '<a class="active" h', $line); } echo $line."\n"; [/code] Can I modify this to work for my submenu? Thank you!