...

View Full Version : anyone can relate my problem? change bgcolor of menu when click



che_anj
11-21-2007, 01:32 PM
Hello, I have a horizontal menus, using css. I would like to change the color of 1 column in menu when click the said column.. I actually have this code well the idea is already there, but my problem is, since the menus are member of the while condition, all columns has been changed.. I want only one column change the bgcolor when it clicked itself.


$sql = "SELECT code, menuname, link FROM menus WHERE parent = $code AND acl >= $_SESSION[acl] ORDER BY code, parent";
$res = $db->query($sql);
$url_menu=explode("&",GetURL($link));
$urls=explode("=", $url_menu[1]);
$menname=$urls[1];
while ($row = $res->fetch_assoc())
{
echo "<li style='border-left: 1px solid #202020;'><a href='$row[link]'";
if ($menname == '1') { echo "class='current'"; } else if ($menname == '2') { echo "class='current'";} else { echo "class=''";}echo ">$level $row[menuname]</a></li>";

}
}
dbMenu();


thanks for the help..

mlseim
11-21-2007, 02:02 PM
How do you know which column you've selected?
Is there one variable there that is associated with a column?

che_anj
11-21-2007, 02:15 PM
what i did is I get the current url of page,

$url_menu=explode("&",GetURL($link));
$urls=explode("=", $url_menu[1]);
$menname=$urls[1];

http://mytestweb/_femploy/menu.php?click=client_list.php&menu=1

$menname=$urls[1];

so the $menname= menu 1.

Home | Client | Jobs | Candidates |

if im going to click the Client the current url will be above and explode the url to get the menu which is equal to 1 and put the condition inside the loop

while ($row = $res->fetch_assoc())
{
echo "<li style='border-left: 1px solid #202020;'><a href='$row[link]'";
if ($menname == '1') { echo "class='current'"; } else if ($menname == '2') { echo "class='current'";} else { echo "class=''";}echo ">$level $row[menuname]</a></li>";

}

mlseim
11-21-2007, 06:41 PM
So ... I'm still working on understanding it.

When they click "Client" in your menu, it will then
display the clients, and you want the menu on that page
to change ... example:

Home | Client | Jobs | Candidates |

Now, because they are viewing the list of Clients, that menu
selection is now highlighted different from the others?

This has nothing to do with the loop or list, but the menu itself?

Is that what you mean?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum