Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:04
How to build a Dynamic Menu? Ugent help required.
Poster: ashishd2
Dated: Friday June 2 2006 - 11:24:42 BST
Hi,
I am using Milonic menu in one of my Application.
I want to build a dynamic menu i.e. no. of Menu items may vary accoding to the User role.
Can I use parameterized dynamic URLs inside Milonic menu?
Poster: John
Dated: Tuesday June 6 2006 - 22:48:10 BST
Yes, you can. Change the suffix on your _data file to agree with what you're using; e.g., menu_data.cfm, menu_data.php, etc.
MS Access and menu_data.js
Poster: peterlembke
Dated: Sunday July 2 2006 - 23:16:46 BST
Here is a very simple example of a database driven menu with the help of MS Access.
Code:
<%
' Peter Lembke #Test-MS Access 2000-database menu# 2006-07-02
' Filename: menu_data.asp OBS NOTE: .asp not .js
' Description: Simple test to create a databasedriven menu on a
' MS Internet Information server (Windows XP Pro / Windows server)
' Access 2000
' Database filename: menu.mdb (You have to create your own database)
' Table name: menu (Create this table)
' Table fields: RadID (autonumber), Rad (Memo)
'
' Take the contents from a working menu_data.js and put in field: Rad.
' Now in your main index.htm/default.asp-document, change the phrase:
' <script type="text/javascript" src="menu_data.js"></script>
' to
' <script type="text/javascript" src="menu_data.asp"></script>
'
' Yes, it will work.
' I think this little detail have confused most people
' in the forums who want a database driven menu.
'
' Next step
' is to use the "asp_sqlserver" that's bundled with every menu sample.
' The file default.asp must be modified to work with MS Access, see below.
' and then rename default.asp to a good name like: menu_data.asp
' and of corse create the proper tables and fields in a Access-databasefile.
Dim strConnString, DataPath, MyResponse
DataPath="../db/"
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DataPath & "menu.mdb")
Function MakeMenuData()
' Simply opens the database menu.mdb, table: menu and reads the post with RadID=1.
' Reads the entire contents of field: Rad
Dim MyData, my_Conn, rsMine, SQL
set my_Conn = Server.CreateObject("ADODB.Connection")
Set rsMine = Server.CreateObject("ADODB.Recordset")
my_Conn.Errors.Clear
my_Conn.Open strConnString
my_Conn.Errors.Clear
SQL="select * from [Menu] where [RadID]=1"
rsMine.Open SQL, my_Conn
if not rsMine.EOF then
MyData=rsMine.Fields("Rad")
end if
rsMine.Close
set rsMine = nothing
my_Conn.Close
set my_Conn = nothing
MakeMenuData=MyData
end function
MyResponse=MakeMenuData()
Response.Write(MyResponse)
%>
' Peter Lembke #Test-MS Access 2000-database menu# 2006-07-02
' Filename: menu_data.asp OBS NOTE: .asp not .js
' Description: Simple test to create a databasedriven menu on a
' MS Internet Information server (Windows XP Pro / Windows server)
' Access 2000
' Database filename: menu.mdb (You have to create your own database)
' Table name: menu (Create this table)
' Table fields: RadID (autonumber), Rad (Memo)
'
' Take the contents from a working menu_data.js and put in field: Rad.
' Now in your main index.htm/default.asp-document, change the phrase:
' <script type="text/javascript" src="menu_data.js"></script>
' to
' <script type="text/javascript" src="menu_data.asp"></script>
'
' Yes, it will work.
' I think this little detail have confused most people
' in the forums who want a database driven menu.
'
' Next step
' is to use the "asp_sqlserver" that's bundled with every menu sample.
' The file default.asp must be modified to work with MS Access, see below.
' and then rename default.asp to a good name like: menu_data.asp
' and of corse create the proper tables and fields in a Access-databasefile.
Dim strConnString, DataPath, MyResponse
DataPath="../db/"
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DataPath & "menu.mdb")
Function MakeMenuData()
' Simply opens the database menu.mdb, table: menu and reads the post with RadID=1.
' Reads the entire contents of field: Rad
Dim MyData, my_Conn, rsMine, SQL
set my_Conn = Server.CreateObject("ADODB.Connection")
Set rsMine = Server.CreateObject("ADODB.Recordset")
my_Conn.Errors.Clear
my_Conn.Open strConnString
my_Conn.Errors.Clear
SQL="select * from [Menu] where [RadID]=1"
rsMine.Open SQL, my_Conn
if not rsMine.EOF then
MyData=rsMine.Fields("Rad")
end if
rsMine.Close
set rsMine = nothing
my_Conn.Close
set my_Conn = nothing
MakeMenuData=MyData
end function
MyResponse=MakeMenuData()
Response.Write(MyResponse)
%>