sydd Posted June 24, 2009 Share Posted June 24, 2009 First of all, hi! I've got a little problem with my coding, specifically I'd like to create a dropdown menu in my php code. Let me try to explain what I'm trying to do: I've got a menu on the left, displaying links to 6 projects of ours. When you reach each project site, you can select different sub-pages (team, contact, downloads, etc...). What I'd like to do is simplify the process by adding a dropdown sub-menu to each project. Meaning when I hover with the mouse over project number 1, there's a nifty little box that suddenly appears to the right displaying the different sub-menus. With me so far? Good! I suck at explaining. ;p I've been playing around with <ul> and <li> for acouple of days and somehow I always get the same error message when I try, syntax error on line 7172 unexpected T_somethingorother. Anyway, I digress, here's the code: function getProjectList($strFieldName){ global $conf; $db = new AGDBConnection(); $rs = new AGDBRecordset(); $f = new AGFunctionsLib(); $dbo = $db->init($conf['dsn']); $strCurrLang = $_COOKIE['strCurrLang']; if($strFieldName=='pr_name'){ $sql = "select * from projects where pr_status=1 and pr_lang= '".$f->getCurrentLanguage()."' order by pr_ID DESC"; $rs->query($sql,$dbo); if($rs->getNumRows() > 0){ $intProjectCount = 1; $htmlOut ="<table width='100%' border='0' align='center' cellpadding='1' cellspacing='0'>"; foreach($rs->fetch() as $prs){ $htmlOut .="<tr><td class=\"projectkiri\" ><a href=\"/index.php?page=PROJECTS&id=".$prs['pr_ID']."\">".$prs[$strFieldName]."</a></td></tr>"; $intProjectCount++; } $htmlOut .="</table>"; }else{ $htmlOut ="<table width='100%' border='0' align='center' cellpadding='1' cellspacing='0'>"; $htmlOut .="<tr> <td class='projectkiri'>Belum ada proyek <br>untuk saat ini</td> </tr> </table>"; } } "projectkiri" being project to the left. Basically it's the left-side menu where I'd like to add dropdown-menus. If you guys need anything else or if I wasn't clear enough, I'd be more than happy to provide you with any additional information you need. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/163466-need-help-with-a-dropdown-menu/ Share on other sites More sharing options...
RussellReal Posted June 24, 2009 Share Posted June 24, 2009 I'm sorry to sound condescending.. but there should be absolutely NO reason to have 7000 lines of code in 1 file... also.. what you'd want to do is create a div somewhere in the body.. set it to display: none; in the css.. and make it position: absolute; and then set up mouse over events and use the target element's (the link's) offsetX and offsetY and width attributes to judge where to place the floating div.. and in the function set the floating div to display: block; set the top and left attributes to the correct pixel coordinates, and then make sure u set the width and the height coz position: absolute will rip it off the page and remove its width and height (last time I checked anyway) good luck .. its fairly easy actually, you should be able to manage it Quote Link to comment https://forums.phpfreaks.com/topic/163466-need-help-with-a-dropdown-menu/#findComment-862511 Share on other sites More sharing options...
sydd Posted June 24, 2009 Author Share Posted June 24, 2009 I'm sorry to sound condescending.. but there should be absolutely NO reason to have 7000 lines of code in 1 file... also.. what you'd want to do is create a div somewhere in the body.. set it to display: none; in the css.. and make it position: absolute; and then set up mouse over events and use the target element's (the link's) offsetX and offsetY and width attributes to judge where to place the floating div.. and in the function set the floating div to display: block; set the top and left attributes to the correct pixel coordinates, and then make sure u set the width and the height coz position: absolute will rip it off the page and remove its width and height (last time I checked anyway) good luck .. its fairly easy actually, you should be able to manage it It's actually 8489 lines of code. It's the functions library, and pretty much the only place where I can edit that particular snippet of code (I THINK, like.. 95% sure). I'm fairly new to php, the guy that designed our website was hired by an outside contractor who went bankrupt a while back and now we can't seem to find whoever wrote this bs. So now it's up to me (yay) to change whatever needs changing on the website. I'll try with the div, but like I said, fairly new to coding. Quote Link to comment https://forums.phpfreaks.com/topic/163466-need-help-with-a-dropdown-menu/#findComment-862522 Share on other sites More sharing options...
RussellReal Posted June 24, 2009 Share Posted June 24, 2009 haha if you need any help, my MSN is RussellonMSN@hotmail.com (as seen in the userInfo bar on the left under my avatar and in my sig) Quote Link to comment https://forums.phpfreaks.com/topic/163466-need-help-with-a-dropdown-menu/#findComment-862537 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.