Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2008
    Location
    C:\Wonderland
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to collapse some menus, not all

    I have a hierarchical menu. Right now all subfolders/submenus are expanded. I want *some* not all of the menu folders by default to be collapsed/closed. How?
    I have attached a .jpg of the menu as it appears now.
    Here is the code:
    Code:
    <script type="text/javascript" src="js/dtree.js" ></script>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr >
                <td height="1" align="left" valign="middle" ><img src="images/blank.gif" alt=" " width="1" height="1" /></td>
              </tr>
              <tr bgcolor="">
    
        <td height="20" align="center" valign="middle" bgcolor="#FFFFFF" bordercolor="#FF6633" class="item-heading" style="padding-left:5px;">
       <td>
              </tr>
              <tr>
    
        <td align="left" valign="top">
          <?
     if($_SESSION['admin'] == 1 ) {
    ?>
          <?
    }
    ?>
    <DIV class=dtree style="width: 190px;">
    <!-- <a class="node" href="javascript: d.openAll();">Open all&nbsp;</a> || <a class="node" href="javascript: d.closeAll();">&nbsp;Close all</a> -->
          <script type="text/javascript">
    		d = new dTree('d');
    	   d.add(0,-1,'<B>Admin Panel</B>','welcome.php');
    <?
    if($_SESSION['admin_name']=='admin') {
    recurcive(0);
    ?>
    d.add(99,0,'Exit','logout.php');
    d.add(100,99,'Logout','logout.php');
    <?
    }
    else {
    ?>
    d.add(500,0,'My Account','edit_admin_user.php?id=<?= $_SESSION['admin'] ?>&subadmin=1');
    d.add(501,500,'Edit Account','edit_admin_user.php?id=<?= $_SESSION['admin'] ?>&subadmin=1');
    <?
    recurcive1(0);
    ?>
    d.add(99,0,'Exit','logout.php');
    d.add(100,99,'Logout','logout.php');
    <?
    }
    ?>
    <?
    function recurcive($id)
    {
    	$q=mysql_query("SELECT * FROM tbl_menu_master WHERE parent_id ='".$id."' order by menu_id");
    	$n=mysql_num_rows($q);
    
    	while($r=mysql_fetch_array($q))
    		{
    			?>
    			d.add(<? print $r[menu_id]?>,<? print $r[parent_id]?>,'<? print $r[menu_name] ?>','<? print $r[menu_url] ?>');
    			<?
    			recurcive($r[menu_id]);
    		}
    }
    function recurcive1($id)
    {
    	$q=mysql_query("SELECT m.menu_name,m.parent_id,m.menu_id,m.menu_url,m.image,p.admin_id FROM tbl_menu_master m
    	left join tbl_admin_permission_master p
    on m.menu_id=p.menu_id WHERE p.admin_id=".$_SESSION['admin']." and m.parent_id =".$id." order by m.menu_id") or die(mysql_error());
    
    	$n=mysql_num_rows($q);
    
    	while($r=mysql_fetch_array($q))
    		{
    			?>
    			d.add(<? print $r[menu_id]?>,<? print $r[parent_id]?>,'<? print $r[menu_name] ?>','<? print $r[menu_url] ?>');
    			<?
    			recurcive1($r[menu_id]);
    		}
    }
    ?>
    	document.write(d);
    FYI, tbl_menu_master has nothing that controls whether the folder is expanded or collapsed.
    TIA!
    Leafgreen
    Attached Thumbnails Attached Thumbnails how to collapse some menus, not all-expandedmenus.jpg  

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Could you post a link to your page? we can't parse and reproduce your menu at our end.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Jul 2008
    Location
    C:\Wonderland
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh dang, no. It's in an admin area that I can't provide access to. What should I do?

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    You can save the page as html and upload the necessary scripts and CSS. Or just create a simple demo page and give us a link.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •