ASP XML Production Menu Management program _ Application Skills

Source: Internet
Author: User
Here's the menu.asp code
Program code
' Author: Weeds
' Date: April 24, 2006
' Q q:94440079
' 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")
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>"
menu_temp=menu_temp& "┊<a href= '" &menu_url& "' >" &menu_name& "</a>"
End If
If m=0 Then
menu_temp=menu_temp& "<a href= '" &menu_url& "' target= ' o ' >" &menu_name& "</a>"
menu_temp=menu_temp& "┊<a href= '" &menu_url& "' target= ' o ' >" &menu_name& "</a>"
End If
End If
Set childmenu=nothing
Set goroot=nothing
Set goxml=nothing
End Function
' Output XML menu
Response.Write (Ycms_menu ())
Here's the Menu.xml code:
Program code
<?xml version= "1.0" encoding= "gb2312"?>
<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>
Admin_menu.asp Admin XML File section
Here's admin_menu.asp.
Program code
' Save files with 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
<form action= "? Action=ok" method= "POST" >
<textarea style= ' width:500px;height:200px; ' name= ' content ' >
<%=server.execute ("Menu.xml")%>
<input type= ' Submit ' value= ' modify '/>
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: 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.