I am new to php and mambo which uses a file menu.php to populate the menu items from a mysql database it also sets css formatting for a menu - CODE BELOW
There is a 6th element which is the phone number this is formatted differently - hence the inclusion of class='phone-contact'
I am trying to get the menu item to remain highlighted if it is clicked on. For example if Projects is clicked - I would like Projects menu item to remain Highlighted - like the menu items do when the rollover occurs
Hopefully this makes sence
Thanks for your time - much appreciated Todd
<div id="menu-panel">
<ul>
<?php
$item_id = mysql_escape_string( $_GET['Itemid'] );
$qry = "SELECT id, name, link FROM #__menu WHERE menutype='mainmenu' and parent='0' AND access<='$gid' AND sublevel='0' AND published='1' ORDER BY ordering LIMIT 6";
$database->setQuery($qry);
$rows = $database->loadObjectList();
$counter = 1;
foreach($rows as $row) {
// echo "<li><a href='$row->link&Itemid=$row->id' ".( $row->id == $item_id ? "class='current'" : "" )." ><span>$row->name</span></a></li>";
if ( $counter == 6 ) {
// echo "<li class='phone-contact'><a href='$row->link&Itemid=$row->id' ".( $row->id == $item_id ? "class='current'" : "" )." ><span>$row->name</span></a></li>";
echo "<li class='phone-contact'>".( $row->id == $item_id ? "class='current'" : "" )."<span>$row->name</span></li>";
} else {
echo "<li><a href='$row->link&Itemid=$row->id' ".( $row->id == $item_id ? "class='current'" : "" )." ><span>$row->name</span></a></li>";
}
$counter += 1;
}
?>
</ul>
</div>
There is a 6th element which is the phone number this is formatted differently - hence the inclusion of class='phone-contact'
I am trying to get the menu item to remain highlighted if it is clicked on. For example if Projects is clicked - I would like Projects menu item to remain Highlighted - like the menu items do when the rollover occurs
Hopefully this makes sence
Thanks for your time - much appreciated Todd
<div id="menu-panel">
<ul>
<?php
$item_id = mysql_escape_string( $_GET['Itemid'] );
$qry = "SELECT id, name, link FROM #__menu WHERE menutype='mainmenu' and parent='0' AND access<='$gid' AND sublevel='0' AND published='1' ORDER BY ordering LIMIT 6";
$database->setQuery($qry);
$rows = $database->loadObjectList();
$counter = 1;
foreach($rows as $row) {
// echo "<li><a href='$row->link&Itemid=$row->id' ".( $row->id == $item_id ? "class='current'" : "" )." ><span>$row->name</span></a></li>";
if ( $counter == 6 ) {
// echo "<li class='phone-contact'><a href='$row->link&Itemid=$row->id' ".( $row->id == $item_id ? "class='current'" : "" )." ><span>$row->name</span></a></li>";
echo "<li class='phone-contact'>".( $row->id == $item_id ? "class='current'" : "" )."<span>$row->name</span></li>";
} else {
echo "<li><a href='$row->link&Itemid=$row->id' ".( $row->id == $item_id ? "class='current'" : "" )." ><span>$row->name</span></a></li>";
}
$counter += 1;
}
?>
</ul>
</div>