Highlighting Manu Item : urlQuery
- by phpExe
I want to highlight menu item with url query. But in my function, all items will be "currentt".
I think there is a logic bug in my function:
function channel()
{
if (is_numeric($_GET['kanalID'])) {
$kanalID = $_GET['kanalID'];
}
if ($_GET['kanalID'] == "") {
$kanalID = 1;}
$tv = array(1 => 'tv1', 3 => 'tv2', 7 => 'tv3', 8 => 'tv4', 25 =>
'tv5', 26 => 'tv6', 39 => 'tv7', 41 => 'tv8');
$channel = '<ul class="channeList">';
foreach ($tv as $id => $kanal) {
if($kanalID = $id){$class= "currentt";}
$channel .= '<li>
<a href="http://mysite.com/menu.php?kanalID='.$id.'" class="'.$class.'">'.$kanal.'</a>
</li>';
}
$channel .= '</ul>';
$channel .= '<div class="ply"><iframe src="http://mysite.com/index.php?id='.$kanalID.'&w=500&h=320" frameborder="0" width="500" height="320" ></iframe></div>';
return $channel;
}
echo channel();
How can I fix this?
Thanks alot