PDA

View Full Version : All Levels Navigational Menu



vikas.khairnar
10-21-2009, 09:20 AM
1) Script Title: All Levels Navigational Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/

3) Describe problem: I am using this script for displaying main menus and sub menus but problem is that my main menus (top level menus) are are more in number i.e total 20 menus that menus are not able to fit in my web page so therefore i have added horizontal scroll bar sub menus appear to be ok when the scroll bar is not scrolled but when we scroll to view main menus which are to the extreme right the sub menus are not displayed exactly below the main menu.Please help me what to do......

ddadmin
10-21-2009, 06:37 PM
Please post a link to the page on your site that contains the problematic script so we can check it out.

vikas.khairnar
10-22-2009, 10:30 AM
Hello I am not able to give link of my project but i have give u code that i have used in my web page to build menus.please see it and give me solution on that problem.

<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-base.css" />
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-topbar.css" />
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-sidebar.css" />

<script type="text/javascript" src="ddlevelsfiles/ddlevelsmenu2.js">
</script>
<?
$categories_string="";
$parent_cat_id1=0;
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '".$parent_cat_id1."' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
//$old_path = $cPath_new;
$categories_string .= '<div id="ddtopmenubar" class="mattblackmenu" style="z-index:1000000;overflow-x:scroll;overflow-y:hidden;width:1000px;"><ul style=" width:2700px;">';
$i=1;
$res="";
$j=0;
while ($categories = tep_db_fetch_array($categories_query)) {
$cPath_new ='cPath='.$categories['categories_id'];
$res='rel="ddsubmenu'.$i.'"';
$categories_string .='<li id="'.$res3.'"><a href="'.tep_href_link(FILENAME_DEFAULT, $cPath_new) . '" '.$res.' ><font style="font-size:10px;font-family:Verdana;">'.$categories['categories_name'].'</font></a></li>';
$i++;
}
$categories_string .= '</ul></div>';

echo $categories_string;
?>

<script type="text/javascript">
ddlevelsmenu.setup("ddtopmenubar", "topbar") //ddlevelsmenu.setup("mainmenuid", "topbar")
</script>

<?
$parent_cat_id1=0;
$categories_string1="";
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '".$parent_cat_id1."' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
$i=1;
$res="";

while ($categories = tep_db_fetch_array($categories_query))
{
$idref='id="ddsubmenu'.$i.'"';
$categories_string1 .= '<ul '.$idref.' class="ddsubmenustyle"><div ';
if($i!=6)
{
$categories_string1 .='style="z-index:1000; background-color: #CFCCA9; overflow:auto; overflow-x:hidden; height:350px; width:180px;"';
}
$categories_string1 .='>';
$parent_cat_id1=$categories['categories_id'];
$categories_query1 = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '".$parent_cat_id1."' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
while ($categories1 = tep_db_fetch_array($categories_query1))
{
$res='rel="ddsubmenu'.$i.'"';
$cPath_new ='cPath='.$categories['categories_id'].'_'.$categories1['categories_id'];
$categories_string1 .='<li><a href="'.tep_href_link(FILENAME_DEFAULT, $cPath_new) . '" '.$res.'>'.$categories1['categories_name'].'</a></li>';
}
$i++;
$categories_string1 .= '</div></ul>';

}

echo $categories_string1;

?>