Hi, I am helping debug a website and really need help. I am still pretty new to PHP and need help with the following. The site has one page with horizontal navigation, a section of which should be highlighted according to which page title is selected, it's list (li) then being assigned the class "selected". There are 6 pages that could be selected, each of their lines of HTML beginning as follows:
<ul>
<li <?php is_mSelected(array("contact")); ?>><a href= ... id= ... </a></li>
</ul>
Before that HTML is the following PHP:
<?php
function is_mSelected($toSearch){
$permaL = get_permalink();
$permaL .= "/";
$prArr = explode("/",$permaL);
foreach($toSearch as $toSearchIt){
if ($prArr[4] == $toSearchIt){
echo "class=\"selected\"";
break;
}
}
}
function writeFootTab($toSearch){
$toWrite = array("home","about","services","portfolio","packages","contact");
$permaL = get_permalink();
$permaL .= "/";
$prArr = explode("/",$permaL);
foreach($toSearch as $i => $toSearchIt){
foreach($toSearchIt as $toSearchIt2){
if ($prArr[4] == $toSearchIt2){
echo $toWrite[$i];
break 2;
}
}
}
}
?>
The HTML above works perfectly for the first four pages as they are selected. However, the last 2 do not receive the class "selected" when they are selected. I tried changing the $prArr[4] in the above PHP to $prArr[6], but that didn't help. I would greatly, greatly appreciate your help if you know how to make this work! THANK YOU!