I am trying to figure out how to add a class to a <li> in the autonav header menu if that page has sub pages. So, if the page has sub pages I'd want the output to be something like this:
Here's what I got, but it's not working. It puts a class of nav-dropdown on every li (even ones that dont have children). Any ideas how to fix?
if($c->getNumChildren()){$navDropdown='nav-dropdown';}else{$navDropdown='';}if(empty($navSelected) and empty($isFirstClass) and empty($navDropdown)){$liClass='';}else{$liClass='class="'.$navSelected.' '.$isFirstClass.' '.$navDropdown.'"';}$output[]='<li '.$liClass.'>';
Here's the code I ended up with and it works. Basically, it sees if the page has sub pages and if it is top level. If those are true it adds a certain class (except if that page is the home page).