⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 functions.asp

📁 商务网站,信息分类,可以搜索加上ACCESS数据库
💻 ASP
字号:
<%
'================================== GetPath(pthid,pnam)  ============================
'功能:返回带超链接的路径
'参数:pthid 用逗号分隔的ID号字符串
'      pnam用chr(255)分隔的字符串
'====================================================================================
function GetPath(pthid,pnam,isadm)
    if right(pthid,1) <> "," then pthid = pthid & ","
    pthid = split(pthid,",")
    pnam  = split(pnam,chr(255))
    thispath = ""
    for i = 0 to UBound(pthid) - 2
        if isadm = TRUE then
            thispath = thispath & "∷<a href=""admclass.asp?sortid=" & pthid(i) & """>" & pnam(i) & "</a>"
        else
            thispath = thispath & "∷<a href=""class.asp?sortid=" & pthid(i) & """>" & pnam(i) & "</a>"
        end if
    next
    GetPath = thispath & "∷" & pnam(i)
end function

'============================= replacepath(pid,id,pnam,name)  ======================
'功能:返回按 id 在 pid 中的出现位置 用 name 置换 pnam 中的相应位置的字符串的字符串
'参数:pid 用逗号隔开的ID列表
'      id  待定位的ID
'      pname 由类名组成用chr(255)隔开的路径集
'      name 待置换的类名
'====================================================================================
function replacepath(pid,id,pnam,name)
    dim i
    
    pid = split(pid,chr(44))
    pnam = split(pnam,chr(255))
    for i = 0 to UBound(pid)
        if pid(i) = id then exit for
    next
    pnam(i) = name
    replacepath = join(pnam,chr(255))
end function

'================================== getid(pid)  =====================================
'返回ID集的最后一个ID
'pid ID集
'====================================================================================
function getid(pid)
    pid = split(pid,chr(44))
    getid = pid(UBound(pid))
end function

'===================================  mkhtml(objconn,table,fn,maxrd) ================
'生成[最新登录]静态页面
'objconn ado连接对象 fn 文件名 maxrd 生成的记录条数 table 数据库表名(只可以是new cool)
'====================================================================================
function mkhtml(objconn,table,fn,maxrd)
	dim objRS,sql
	dim fso,f
	dim i

	table = Ucase(table)
	set fso = Server.CreateObject("Scripting.FileSystemObject")
	set f = fso.CreateTextFile(Server.MapPath(fn),TRUE)  '若有则覆盖
	if table = "NEW" then
		sql = "select * from new order by thisdate DESC"
	elseif table = "COOL" then
		sql = "select * from cool order by visitcount DESC"
	end if
	Set objRS = objConn.Execute(sql)

	f.writeline("      <table border=""0"" width=""100%"" cellpadding=""0""  cellspacing=""0"">")
	f.writeline("        <tr>")
	f.writeline("          <td width=""100%""><p style=""line-height: 150%"">")


	if objRS.EOF then
		if table = "NEW" then
			f.writeline("<center>暂无最新加入</center>")
		elseif table = "COOL" then
			f.writeline("<center>暂无推荐站点</center>")
		end if
	else
		f.writeline("")
		for i = 1 to maxrd
			if objRS.EOF then exit for
	        f.writeline("- <a href=information.asp?ID="& objRS("id")&" target=_blank>" & objRS("title") & "</a><br>")
		    objRS.MoveNext()
	    next
		f.writeline("")
	end if

	f.writeline("    </td>")
	f.writeline("  </tr>")
	f.writeline("  <tr>")
	f.writeline("    <td height=""21"" align=""right"">")
	if table = "NEW" then
'		f.writeline("<a href=""morenew.asp"" target=""_blank"">更多...</a> ")
		f.writeline("<a href=""Submit-class.asp"" target=""_blank"">点击发布您的信息</a> ")
	elseif table = "COOL" then
'		f.writeline("       <p align=""right""><a href=""morecool.asp"" target=""_blank"">更多...</a> </p>")
        f.writeline("       <p align=""right""><a href=""Submit-class.asp"" target=""_blank"">点击发布您的信息</a> </p>")
	end if
	f.writeline("    </td>")
	f.writeline("  </tr>")
	f.writeline("</table>")

	f.Close()
	Set objRS = nothing
	Set fso = nothing
end function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -