Hi folks,
I have a “strange” problem with a menu. The problem is the “active” state on the clients in the menu.
The code selects subcategories and clients from the database and orders the clients by a cli_order field.
I want the cli_order to sort ascending but when I do, the active link doesn’t work properly. If I change the order to descending then it works as it should do.
The page shows correct content all the time, it’s only the “active” state that’s not working.
Here is the menu code:
<ul id="dhtmlgoodies_listMenu">
<li style="margin-bottom: 3px;"><a href='/about/#'>Om Ego Design</a></li>
<li style="margin-bottom: 3px;"><a href='/contact/#'>Kontakt</a></li><br />
<?php
$sec_id = 3; // portfolio sector id
$sql = "SELECT id, no_name FROM sector WHERE parentid=(SELECT id FROM sector WHERE id=$sec_id) ORDER BY cat_order ASC";
$link = mysql_query($sql);
$menu_final = '';
while( list($sid, $no_name) = mysql_fetch_array($link) ):
$category_link = '<a href="#">' . $no_name . '</a>';
$menu_final .="<li>\ " . $category_link . "\
";
$menu_final .="<ul>";
$sql = "SELECT DISTINCT clients.id, clients.name, clients.cli_order, content.subsectorid FROM clients, content WHERE clients.id=content.clientid AND content.sectorid=$sec_id AND content.subsectorid=$sid ORDER BY clients.cli_order ASC";
$link2 = mysql_query($sql);
while( $row = mysql_fetch_array($link2) ):
$client_link = '<a href="/portfolio/?sid=' . $row['subsectorid']. '&cid=' . $row['id'] . '">' . $row['name'] . ' </a>';
$menu_final .= "<li>\ " . $client_link . "</li>\
";
endwhile;
$menu_final .="</ul></li>";
endwhile;
echo $menu_final;
?>
</ul>
Here is the link to the page with ascending clients: http://egodesign.no/portfolio/?sid=6&cid=12
Here is the link when cli_order is changed to DESC: http://egodesign.no/portfolio/index2.php?sid=6&cid=12
I use listmenu.js to generate the code:
http://egodesign.no/js/listmenu.js
Thanks for any help.