Turn Dreamweaver popup menu dynamic
Hi all!
I'm quite new here and hope to find/give some answers.
Right nom, I'm looking for a simple way to turn the Dreaweaver MX popup menu dynamic (getting the content of my menu from a database). Any idea on how I can do this?
Thx
Comments
lşfdls
popup dynamic menu
You need to set up a repeat region for the record around the dynamic text for the menu. I was just doing this with ASP and an access database. I found I had to code in the full page path as all you are doing is passing the ID. You may also have to alter the width of the dynamic list area as it first started to show really wide I have made it '150' and have highlighted this below in red/bold. I have also marked important code so you can see what has been done.
Hope this helps.
Sam
Below is the code for it to work in full:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/yourconnection.asp" -->
<%
Dim list__MMColParam
list__MMColParam = "define"
If (Request("MM_EmptyValue") <> "") Then
list__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim list
Dim list_numRows
Set list = Server.CreateObject("ADODB.Recordset")
list.ActiveConnection = MM_conn_site_STRING
list.Source = "SELECT * FROM accesstable WHERE position = '" + Replace(list__MMColParam, "'", "''") + "'"
list.CursorType = 0
list.CursorLocation = 2
list.LockType = 1
list.Open()
list_numRows = 0
%>
<%
Dim Repeatlist__numRows
Dim Repeatlist__index
Repeatlist__numRows = 10
Repeatlist__index = 0
list_numRows = list_numRows + Repeat1__numRows
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset="iso"-8859-1">
<script language="JavaScript">
<!--
function mmLoadMenus() {
if (window.mm_menu_0204074616_0) return;
window.mm_menu_0204074616_0 = new Menu("root",150,16,"Arial, Helvetica, sans-serif",10,"#000000","#FFFFFF","#CCCCCC","#666666","left","middle",3,0,150,5,7,true,false,true,0,true,true);
<%
While ((Repeatlist__numRows <> 0) AND (NOT list.EOF))
%>
mm_menu_0204074616_0.addMenuItem("<%=(list.Fields.Item("fname").Value)%> <%=(list.Fields.Item("sname").Value)%>","location='yourpage.asp'?ID=<%=(list.Fields.Item("ID").Value)%>'");
<%
repeatlist__index="Repeatlist__index"+1
repeatlist__numrows="Repeatlist__numRows"-1
list.MoveNext()
Wend
%>
mm_menu_0204074616_0.hideOnMouseOut=true;
mm_menu_0204074616_0.bgColor='#555555';
mm_menu_0204074616_0.menuBorder=1;
mm_menu_0204074616_0.menuLiteBgColor='#FFFFFF';
mm_menu_0204074616_0.menuBorderBgColor='#777777';
mm_menu_0204074616_0.writeMenus();
} // mmLoadMenus()
//-->
</script>
<script language="JavaScript" src="mm_menu.js"></script>
</head>
<body>
<p>
<script language="JavaScript1.2">mmLoadMenus();</script>
<a href="javascript:;" name="link1" id="link1" onMouseOver="MM_showMenu(window.mm_menu_0204074616_0,0,16,null,'link1')" onMouseOut="MM_startTimeout();">index</a>
</p>
<p> </p>
<p> </p>
</body>
</html>
<%
list.Close()
Set list = Nothing
%>
You must me logged in to write a comment.