menu.asp, this is the front desk Executive Section .
Here's the menu.asp code:
<%
’---------------------------------------
' Author: Weeds
' Date: April 24, 2006
' Q q:94440079
' 51 Group: 21643964 (51JS. COM's Group)
' Site: http://www.yecaoweb.com OR http://www.yecaoweb.net
’---------------------------------------
' Read XML file functions
Function Ycms_menu ()
Dim menu_temp,m
Set goxml=server.createobject ("Microsoft.XMLDOM")
Goxml.load (Server.MapPath ("Menu.xml"))
Set goroot=goxml.documentelement.selectsinglenode ("menu")
M=0
For each child in Goroot.childnodes
Set Childmenu=goroot.childnodes.item (m)
Dim Menu_open,menu_title,menu_url
Menu_open=childmenu.getattributenode ("Open"). NodeValue
Menu_name=childmenu.getattributenode ("name"). NodeValue
Menu_url=goroot.childnodes.item (m). Text
' Judge whether it is a pop-up window
If menu_open=0 Then
' Decide if it's the first one, and if it's the first one, get rid of ' ┊ '
If m=0 Then
menu_temp=menu_temp& "<a href= '" &menu_url& "' >" &menu_name& "</a>"
Else
menu_temp=menu_temp& "┊<a href= '" &menu_url& "' >" &menu_name& "</a>"
End If
Else
If m=0 Then
menu_temp=menu_temp& "<a href= '" &menu_url& "' target= ' o ' >" &menu_name& "</a>"
Else
menu_temp=menu_temp& "┊<a href= '" &menu_url& "' target= ' o ' >" &menu_name& "</a>"
End If
End If
Set childmenu=nothing
M=m+1
Next
Set goroot=nothing
Set goxml=nothing
Ycms_menu=menu_temp
End Function
' Output XML menu
Response.Write (Ycms_menu ())
%> |
Menu.xml XML data file
Here's the Menu.xml code:
<?xml version= "1.0" encoding= "gb2312"?>
<xml>
<menu>
<url name= "Site Home" open= "0" >index.asp</url>
<url name= "News" open= "0" >News.asp</url>
<url name= "Article Center" open= "0" >Art.asp</url>
<url name= "Picture Show" open= "0" >Pic.asp</url>
<url name= "AV Entertainment" open= "0" >Dj.asp</url>
<url name= "Resource Download" open= "0" >Down.asp</url>
<url name= "message discussion" open= "0" >Book.asp</url>
<url name= "Friendship Connection" open= "0" >Link.asp</url>
</menu>
</xml> |
Admin_menu.asp Admin XML File section
here is admin_menu.asp:
<%
' Save files with Ado.stream component
Function Save (File_body,file_name)
Set os=server.createobject ("ADODB. Stream ")
OS. type=2
OS. Open
OS. charset= "GB2312"
OS. Position=os. Size
OS. Writetext=file_body
OS. SaveToFile Server.MapPath (file_name), 2
OS. Close
Set os=nothing
End Function
If Request.QueryString ("action") = "OK" then
Call Save (Request.Form ("content"), "Menu.xml")
End If
%>
<title></title>
<body>
<form action= "? Action=ok" method= "POST" >
<textarea style= ' width:500px;height:200px; ' name= ' content ' >
<%=server.execute ("Menu.xml")%>
</textarea>
<input type= ' Submit ' value= ' modify '/>
</form>
</body>
|