How to build a Dynamic Menu? Ugent help required.

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
ashishd2
Beginner
Beginner
Posts: 1
Joined: Fri Jun 02, 2006 11:15 am

How to build a Dynamic Menu? Ugent help required.

Post by ashishd2 »

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?
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

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.
John
peterlembke
Beginner
Beginner
Posts: 3
Joined: Sun Jul 02, 2006 11:10 pm
Location: Sweden
Contact:

MS Access and menu_data.js

Post by peterlembke »

Here is a very simple example of a database driven menu with the help of MS Access.

Code: Select all

<%
' 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)

%>
Post Reply