国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

ASP XML制作菜單管理程序

2024-05-04 11:09:01
字體:
來源:轉載
供稿:網友
利用asp+xml實現代碼管理,實際就是利用asp操作xml
 
 
 
以下是menu.asp代碼 
程序代碼 
<% 
'--------------------------------------- 
'作者:野 草 
'日期:2006年4月24日 
'Q Q:94440079 
'--------------------------------------- 
'讀取XML文件函數 
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 
'判斷是否是彈出窗口 
If menu_open=0 Then 
'判斷是否是第一個,若是第一個則去掉"┊" 
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 
'輸出XML菜單 
response.write(YCMS_menu()) 
%> 
以下是menu.xml代碼: 
程序代碼 
<?xml version="1.0" encoding="gb2312"?> 
<xml> 
<menu> 
<url name="網站首頁" open="0">index.asp</url> 
<url name="新聞動態" open="0">News.asp</url> 
<url name="文章中心" open="0">Art.asp</url> 
<url name="圖片展示" open="0">Pic.asp</url> 
<url name="影音娛樂" open="0">Dj.asp</url> 
<url name="資源下載" open="0">Down.asp</url> 
<url name="留言討論" open="0">Book.asp</url> 
<url name="友情連接" open="0">Link.asp</url> 
</menu> 
</xml> 
admin_menu.asp 后臺管理XML文件部分 
以下是admin_menu.asp 
程序代碼 
<% 
'利用ADO.Stream組件保存文件 
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 
%> 
<html> 
<head> 
<title></title> 
</head> 
<body> 
<form action="?action=ok" method="post"> 
<textarea style='width:500px;height:200px;' name='content'> 
<%=server.execute("menu.xml")%> 
</textarea> 
<input type='submit' value='修 改' /> 
</form> 
</body> 
</html>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 比如县| 牡丹江市| 富裕县| 巧家县| 盐山县| 霍山县| 会泽县| 土默特左旗| 曲阜市| 阜南县| 平昌县| 海淀区| 宁城县| 菏泽市| 浏阳市| 张家口市| 乐安县| 怀远县| 南澳县| 平利县| 泾川县| 枝江市| 四子王旗| 长汀县| 玛曲县| 郓城县| 大理市| 敦化市| 陵水| 章丘市| 吉隆县| 赤峰市| 桦川县| 湄潭县| 囊谦县| 剑河县| 天门市| 陕西省| 临沭县| 怀仁县| 石狮市|