"Original" Asp+xml production menu Management!

Source: Internet
Author: User
Tags end reference
menu.asp, this is the front desk Executive Section .

The following is a reference fragment:
QUOTE:
<%

' 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&

"" &menu_name& ""

Else

menu_temp=menu_temp& "┊" &menu_name& ""

End If

Else

If m=0 Then

menu_temp=menu_temp& "" &menu_name& ""

Else

menu_temp=menu_temp& "┊" &menu_name& ""

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

The following is a reference fragment:
QUOTE:



index.asp
News.asp
Art.asp
Pic.asp
Dj.asp
Down.asp
Book.asp
Link.asp


admin_menu.asp Admin XML file section

The following is a reference fragment:
QUOTE:
<%
' 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
%>






<br /><%=server.execute ("Menu.xml")%><br /><br /><input type= ' Submit ' value= ' modify '/><br /><br /><br /></td></tr></tbody></table><br /> <br />
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.