Highlighting Manu Item : urlQuery

Posted by phpExe on Stack Overflow See other posts from Stack Overflow or by phpExe
Published on 2010-06-09T11:57:10Z Indexed on 2010/06/09 12:02 UTC
Read the original article Hit count: 278

Filed under:

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

© Stack Overflow or respective owner

Related posts about php