1cls_public.asp

来自「小游戏网站演示www.4399.io 拥有4万条游戏数据」· ASP 代码 · 共 1,477 行 · 第 1/5 页

ASP
1,477
字号
			foundstr = "order by a.writetime desc ,a.articleid desc"
		end select
		if clng(classid) > 0 then
			foundstr = "and a.classid in (" & childstr & ") " & foundstr
		end if
		if clng(specialid) > 0 then
			foundstr = "and a.specialid =" & clng(specialid) & " " & foundstr
		end if
		if m_strid <> "" and m_strid <> "0" then
			foundstr = "and a.articleid in (" & m_strid & ") order by a.articleid desc"
		end if
		sql = " a.articleid,a.classid,a.title,a.content,a.allhits,a.writetime,a.htmlfiledate,a.isbest,a.imageurl,"
		sql = "select top " & cint(topnum) & sql & " c.classname,c.htmlfiledir,c.usehtml from [nc_article] a inner join [nc_classify] c on a.classid=c.classid where a.isaccept > 0 and a.imageurl<>'' and a.channelid=" & channelid & " " & foundstr & ""
		set rs = newasp.execute(sql)
		if rs.bof and rs.eof then
			strcontent = "<img src=""" & newasp.siteurl & newasp.installdir & "images/no_pic.gif"" width=""" & width & """ height=""" & height & """ border=""0""/>"
		else
			n = 0
			'-- 是否启用幻灯片效果
			if slide>0 then
				set xmldom=server.createobject("msxml2.freethreadeddomdocument"& msxmlversion)
				xmldom.appendchild(xmldom.createelement("xml"))
				'-- 幻灯片效果基本设置
				set node=xmldom.createnode(1,"setting","")
				node.attributes.setnameditem(xmldom.createnode(2,"channelid","")).text = channelid
				node.attributes.setnameditem(xmldom.createnode(2,"width","")).text = width
				node.attributes.setnameditem(xmldom.createnode(2,"height","")).text = height
				if showtopic=1 then
					node.attributes.setnameditem(xmldom.createnode(2,"text_height","")).text = 20
				else
					node.attributes.setnameditem(xmldom.createnode(2,"text_height","")).text = 0
				end if
				node.attributes.setnameditem(xmldom.createnode(2,"maxpic","")).text = topnum
				node.attributes.setnameditem(xmldom.createnode(2,"maxlen","")).text = strlen
				node.attributes.setnameditem(xmldom.createnode(2,"path","")).text = newasp.installdir
				node.attributes.setnameditem(xmldom.createnode(2,"slidetype","")).text = slide
				xmldom.documentelement.appendchild(node)
			end if
			do while not rs.eof
				n = n + 1
				if slide>0 then
					stitle = newasp.gottopic(rs("title"), cint(strlen))
					imageurl = newasp.getimageurl(rs("imageurl"), newasp.channelpath)
					if cint(newasp.channelusehtml) <> 0 then
						htmlfileurl = newasp.channeldomain & newasp.readdestination(newasp.m_infodestination, newasp.m_channeldir, rs("htmlfiledate"),rs("htmlfiledir"),rs("classid"),rs("articleid"),1,"")
					else
						if isurlrewrite then
							htmlfileurl = newasp.channelpath & rs("articleid") & newasp.channelhtmlext
						else
							htmlfileurl = newasp.channelpath & "show.asp?id=" & rs("articleid")
						end if
					end if
					'-- 装幻灯片信息传递给xml节点
					set node=xmldom.createnode(1,"slide","")
					node.attributes.setnameditem(xmldom.createnode(2,"slideid","")).text = n
					node.attributes.setnameditem(xmldom.createnode(2,"classid","")).text = classid
					node.attributes.setnameditem(xmldom.createnode(2,"title","")).text = replace(stitle, "|", "")
					node.attributes.setnameditem(xmldom.createnode(2,"picurl","")).text = replace(imageurl, "|", "")
					node.attributes.setnameditem(xmldom.createnode(2,"url","")).text = replace(htmlfileurl, "|", "")
					node.attributes.setnameditem(xmldom.createnode(2,"addtime","")).text = rs("writetime")
					xmldom.documentelement.appendchild(node)
				else
					textcontent = ""
					for i = 1 to cint(perrownum)
						if not rs.eof then
							stitle = newasp.gottopic(rs("title"), cint(strlen))
							imageurl = newasp.getimageurl(rs("imageurl"), newasp.channelpath)
							imageurl = newasp.getflashandpic(imageurl, height, width)

							if cint(newasp.channelusehtml) <> 0 then
								htmlfileurl = newasp.channeldomain & newasp.readdestination(newasp.m_infodestination, newasp.m_channeldir, rs("htmlfiledate"),rs("htmlfiledir"),rs("classid"),rs("articleid"),1,"")
							else
								if isurlrewrite then
									htmlfileurl = newasp.channelpath & rs("articleid") & newasp.channelhtmlext
								else
									htmlfileurl = newasp.channelpath & "show.asp?id=" & rs("articleid")
								end if
							end if
							
							if cint(newindow) <> 0 then
								linktarget = " target=""_blank"""
							else
								linktarget = ""
							end if
							'--文章内容
							if strmaxlen > 5 then
								textcontent = newasp.cutstring(rs("content"),strmaxlen)
								textcontent = newasp.gottopic(textcontent,strmaxlen)
								textcontent = "<a href=""" & htmlfileurl & """" & linktarget & ">" & textcontent & "</a>"
							end if

							strcontent = strcontent & newasp.mainsetting(18)
							strcontent = replace(strcontent, "{$articlepicture}", "<a href=""" & htmlfileurl & """ title=""" & rs("title") & """" & linktarget & ">" & imageurl & "</a>")
							if cint(showtopic) = 1 then
								strcontent = replace(strcontent, "{$articletopic}", "<a href=""" & htmlfileurl & """ title=""" & rs("title") & """" & linktarget & ">" & stitle & "</a>")
							else
								strcontent = replace(strcontent, "{$articletopic}", vbnullstring)
							end if
							strcontent = replace(strcontent, "{$textcontent}", textcontent)
							strcontent = replace(strcontent, "{$orderid}", i)
							rs.movenext
						end if
					next
				end if
				if slide>0 then rs.movenext
			loop
			if slide>0 then
				set xmlnode = xmldom.clonenode(true)
				set xslt = server.createobject("msxml2.xsltemplate" & msxmlversion)
				set xmlstyle = server.createobject("msxml2.freethreadeddomdocument"& msxmlversion)
				if xmlstyle.load(server.mappath(newasp.installdir & "inc/xslt/nc_slide.xslt")) then
					xslt.stylesheet = xmlstyle
					set proc = xslt.createprocessor()
					proc.input = xmlnode
					proc.transform()
					strcontent = proc.output
					set proc = nothing
				else
					strcontent = vbnullstring
				end if
				set xmlstyle = nothing
				set xslt = nothing:set xmlnode = nothing
				set node = nothing:set xmldom = nothing
			end if
		end if
		rs.close: set rs = nothing
		loadarticlepic = strcontent
	end function
	'================================================
	'函数名:readarticlepic
	'作  用:读取文章图片列表
	'参  数:str ----原字符串
	'================================================
	public function readarticlepic(byval str)
		dim strtemp, i
		dim stempcontent, ntempcontent, arraylist
		dim arrtempcontent, arrtempcontents
		strtemp = str
		if instr(strtemp, "{$readarticlepic(") > 0 then
			stempcontent = newasp.cutmatchcontent(strtemp, "{$readarticlepic(", ")}", 1)
			ntempcontent = newasp.cutmatchcontent(strtemp, "{$readarticlepic(", ")}", 0)
			arrtempcontents = split(stempcontent, "|||")
			arrtempcontent = split(ntempcontent, "|||")
			for i = 0 to ubound(arrtempcontents)
				arraylist = split(arrtempcontent(i) & ",0,0,0", ",")
				strtemp = replace(strtemp, arrtempcontents(i), loadarticlepic(arraylist(0), arraylist(1), arraylist(2), arraylist(3), arraylist(4), arraylist(5), arraylist(6), arraylist(7), arraylist(8), arraylist(9), arraylist(10),arraylist(11),arraylist(12),arraylist(13)))
			next
		end if
		readarticlepic = strtemp
	end function
	'================================================
	'函数名:loadsoftpic
	'作  用:装载软件图片列表
	'参  数:classid   ----分类id
	'        channelid   ----频道id
	'        stype   ----调用软件类型,0=所有最新软件,1=推荐软件,2=热门软件
	'        topnum   ----显示软件列表数
	'        strlen   ----显示标题长度
	'        newindow   ----新窗口打开
	'================================================
	public function loadsoftpic(byval channelid, byval classid, byval specialid, byval stype, byval topnum, byval perrownum, _
		byval strlen, byval newindow, byval width, byval height, byval showtopic, byval slide,byval strmaxlen,byval id,byval strtype,byval intdirect)
		
		dim rs, sql, i, strcontent, foundstr, n
		dim strsoftname, childstr, softimage, htmlfilename
		dim htmlfileurl, softtime, linktarget,textcontent,m_strid
		dim xmldom,xmlnode,node,xslt,xmlstyle,proc,inewindow
		
		channelid = newasp.chknumeric(channelid)
		classid = newasp.chknumeric(classid)
		specialid = newasp.chknumeric(specialid)
		stype = newasp.chknumeric(stype)
		height = newasp.chknumeric(height)
		width = newasp.chknumeric(width)
		slide = newasp.chknumeric(slide)
		intdirect = newasp.chknumeric(intdirect)
		inewindow = newasp.chknumeric(newindow)
		strmaxlen = newasp.chknumeric(strmaxlen)
		m_strid = replace(replace(trim(id), ";", ","), ";", ",")
		strtype = replace(trim(strtype), "'", "")
		
		newasp.loadchannel(channelid)
		
		if clng(classid) > 0 then
			sql = "select childstr from [nc_classify] where channelid=" & channelid & " and classid=" & classid
			set rs = newasp.execute(sql)
			if rs.bof and rs.eof then
				set rs = nothing
				loadsoftpic = ""
				exit function
			else
				childstr = rs("childstr")
			end if
			rs.close
		else
			childstr = 0
		end if
		select case cint(stype)
			case 0,3: foundstr = "order by a.softtime desc ,a.softid desc"
			case 1,4: foundstr = "and a.isbest > 0 order by a.softtime desc ,a.softid desc"
			case 2,5: foundstr = "order by a.allhits desc ,a.softid desc"
			case 9
				if issqldatabase = 1 then
					foundstr = "order by newid()"
				else
					foundstr = "order by rnd(a.softid)"
				end if
		case else
			foundstr = "order by a.softtime desc ,a.softid desc"
		end select
		if clng(classid) > 0 then
			foundstr = "and a.classid in (" & childstr & ") " & foundstr
		end if
		if len(strtype) > 1 then
			foundstr = "and a.softtype='" & strtype & "' " & foundstr
		end if
		if clng(specialid) > 0 then
			foundstr = "and a.specialid =" & clng(specialid) & " " & foundstr
		end if
		if m_strid <> "" and m_strid <> "0" then
			foundstr = "and a.softid in (" & m_strid & ") order by a.softid desc"
		end if
		
		sql = " a.softid,a.classid,a.softname,a.softver,a.content,a.allhits,a.softtime,a.htmlfiledate,a.isbest,a.softimage,a.outerlinks,a.regsite,"
		sql = "select top " & cint(topnum) & sql & " c.classname,c.htmlfiledir,c.usehtml from [nc_softlist] a inner join [nc_classify] c on a.classid=c.classid where a.isaccept>0 and a.softimage<>'' and a.channelid=" & channelid & " " & foundstr & ""
		set rs = newasp.execute(sql)
		if rs.bof and rs.eof then
			strcontent = "<img src=""" & newasp.siteurl & newasp.installdir & "images/no_pic.gif"" width=""" & width & """ height=""" & height & """ border=""0""/>"
		else
			n = 0
			'-- 是否启用幻灯片效果
			if slide>0 then
				set xmldom=server.createobject("msxml2.freethreadeddomdocument"& msxmlversion)
				xmldom.appendchild(xmldom.createelement("xml"))
				'-- 幻灯片效果基本设置
				set node=xmldom.createnode(1,"setting","")
				node.attributes.setnameditem(xmldom.createnode(2,"channelid","")).text = channelid
				node.attributes.setnameditem(xmldom.createnode(2,"width","")).text = width
				node.attributes.setnameditem(xmldom.createnode(2,"height","")).text = height
				if showtopic=1 then
					node.attributes.setnameditem(xmldom.createnode(2,"text_height","")).text = 20
				else
					node.attributes.setnameditem(xmldom.createnode(2,"text_height","")).text = 0
				end if
				node.attributes.setnameditem(xmldom.createnode(2,"maxpic","")).text = topnum
				node.attributes.setnameditem(xmldom.createnode(2,"maxlen","")).text = strlen
				node.attributes.setnameditem(xmldom.createnode(2,"path","")).text = newasp.installdir
				node.attributes.setnameditem(xmldom.createnode(2,"slidetype","")).text = slide
				xmldom.documentelement.appendchild(node)
			end if
			do while not rs.eof
				n = n + 1
				if slide>0 then
					strsoftname = newasp.gottopic(trim(rs("softname") & " " & rs("softver")), cint(strlen))
					softimage = newasp.getimageurl(rs("softimage"), newasp.channelpath)
					if intdirect = 1 and len(rs("regsite") & "") > 5 then
						if instr(rs("regsite"), "://") > 0 then
							htmlfileurl = trim(rs("regsite"))
						else
							htmlfileurl = "http://" & trim(rs("regsite"))
						end if
					else
						if cint(newasp.channelusehtml) <> 0 then
							htmlfileurl = newasp.channeldomain & newasp.readdestination(newasp.m_infodestination, newasp.m_channeldir, rs("htmlfiledate"),rs("htmlfiledir"),rs("classid"),rs("softid"),1,"")
						else
							if isurlrewrite then
								htmlfileurl = newasp.channelpath & rs("softid") & newasp.channelhtmlext
							else
								htmlfileurl = newasp.channelpath & "show.asp?id=" & rs("softid")
							end if
						end if
					end if
					'-- 装幻灯片信息传递给xml节点
					set node=xmldom.createnode(1,"slide","")
					node.attributes.setnameditem(xmldom.createnode(2,"slideid","")).text = n
					node.attributes.setnameditem(xmldom.createnode(2,"classid","")).text = classid
					node.attributes.setnameditem(xmldom.createnode(2,"title","")).text = replace(strsoftname, "|", "")
					node.attributes.setnameditem(xmldom.createnode(2,"picurl","")).text = replace(softimage, "|", "")
					node.attributes.setnameditem(xmldom.createnode(2,"url","")).text = replace(htmlfileurl, "|", "")
					node.attributes.setnameditem(xmldom.createnode(2,"addtime","")).text = rs("softtime")
					xmldom.documentelement.appendchild(node)
				else
					textcontent = ""
					for i = 1 to cint(perrownum)
						if not rs.eof then
							strsoftname = newasp.gottopic(trim(rs("softname") & " " & rs("softver")), cint(strlen))
							softimage = newasp.getimageurl(rs("softimage"), newasp.channelpath)
							softimage = newasp.getflashandpic(softimage, height, width)
							if intdirect = 1 and len(rs("regsite") & "") > 5 then
								if instr(rs("regsite"), "://") > 0 then
									htmlfileurl = trim(rs("regsite"))
								else
									htmlfileurl = "http://" & trim(rs("regsite"))
								end if
								inewindow = 1
							else

⌨️ 快捷键说明

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