ASP+XML制作菜单管理
作者:野草 来源:无忧脚本 发布时间:2008-05-19 12:38:00
标签:菜单,xml,asp
ASP+XML制作菜单管理!
menu.asp 这个是前台执行部分
<%
'---------------------------------------
'作者:野 草
'日期:2006年4月24日
'Q Q:94440079
'51群:21643964(51JS.COM的群)
'---------------------------------------
'读取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数据文件
<?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文件部分
<%
'利用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>
注:由于时间问题,没来得及测试!我^_^#
0
投稿
猜你喜欢
- 广州4.18书友会主题的内容提纲自己参与撰写,同时还参与组织和主持。通过这次的深入参与,我发现胡晓同学能坚持下来多不容易,先赞下。由于天公不
- asp日期转换星座函数,参数是日期型function astro(birth)astro=""if
- 本文实例讲述了python实现堆栈与队列的方法。分享给大家供大家参考。具体分析如下:1、python实现堆栈,可先将Stack类写入文件st
- python实现PSO算法优化二元函数,具体代码如下所示:import numpy as np import random import m
- 你一定很熟悉Youtube了,知道它是一个视频分享网站。是的,youtube目前十分流行,你也许会常常访问。这里有一些关于youtube u
- 本文实例为大家分享了python实现大转盘抽奖的具体代码,供大家参考,具体内容如下选择转盘中的某一个方框,来进行抽奖import tkint
- 前言这篇文章主要介绍了pyinstaller打包opencv和numpy程序运行错误解决,文中通过示例代码介绍的非常详细,对大家的学习或者工
- 项目地址:https://github.com/astak16/shortlink错误处理在处理业务逻辑时,如果出错误了,需要统一处理错误响
- 前言前面几个章节我们学习了对于普通文件的操作,比如说文件的创建、复制粘贴、裁剪粘贴、文件名的重命名、删除等等。另外还学习了一些基本练习,如何
- 本文实例讲述了Python简单实现的代理服务器端口映射功能。分享给大家供大家参考,具体如下:一 代码1、模拟服务端代码import sysi
- 本文实例讲述了JS生成一维码(条形码)功能的方法。分享给大家供大家参考,具体如下:1、js代码:(function() { if (!exp
- 本文实例为大家分享了python实现双链表的具体代码,供大家参考,具体内容如下实现双链表需要注意的地方1、如何插入元素,考虑特殊情况:头节点
- 之前整理发表了《XMLHTTPRequest的属性和方法简介》,它ajax要使用的核心的技术之一,现在就来实际运用它。这个Ajax标签导航,
- 最近导师让我跑模型,生物信息方向的,我一个学计算机的,好多东西都看不明白。现在的方向大致是,用深度学习的模型预测病毒感染人类的风险。既然是病
- 今天我们来介绍下Python基础教程学习之iter() 方法另外的用法。据说很少有人知道这个用法!一、上代码、学用法我们都比较熟悉 iter
- 本文实例为大家分享了tensorflow使用CNN分析mnist手写体数字数据集,供大家参考,具体内容如下import tensorflow
- 在本项目中,将会用Keras来搭建一个稍微复杂的CNN模型来破解以上的验证码。验证码如下: 利用Keras可以快速方便地搭建CNN
- 块级元素块级元素生成一个元素框,(默认地)它会填充其父级元素的内容,旁边不能有其他元素。换句话说,他在元素框之前和之后生成了“分隔”符。我们
- 由于画图时plt.title()默认是显示英文,如果我们设置标题为中文,会无法显示,如图:在最前边设置这两条属性即可:plt.rcParam
- axios form-data格式 传输数据和文件form-data是在post请求下的一种传输方式,数据会在Form Data中传输,他的