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

📄 search2html.asp

📁 gmaple软件下载系统1.0Beta 具有一下功能: 1.模板功能,前台的呈现更加灵活. 2.支持静态生成,可在动态与静态间随时切换. 3.在静态模式下,可自定义生成目录,生成方式灵活.
💻 ASP
字号:
<!--#include file="Config.asp"-->
<!--#include file="Templet2Html.asp"-->
<!--#include file="../admin/Fun2HTML.asp"-->
<%
if request.QueryString.Count>0 then
keyWord = request.QueryString("q")
if keyWord="" then
	call ShowErr("参数错误!","1")
end if
sql="select COUNT(*) as SD_Search_Count from [Softs] where"
keyWordList = split(keyWord)
for i = 0 to Ubound(KeyWordList)
	sql=sql&" SD_Soft_Name like '%"&keyWordList(i)&"%' or SD_Soft_Info like '%"&keyWordList(i)&"%' or"
next
sql=left(sql,len(sql)-3)
'debug(sql)
set rst=conn.execute(sql)
	Search_Count=rst("SD_Search_Count")
rst.close

if Search_Count=0 then
	Cyc_Time=1
elseif Search_Count mod Page_Size_All = 0 then
	Cyc_Time=Search_Count\Page_Size_All				'Cyc_Time 页面生成次数
else
	Cyc_Time=Search_Count\Page_Size_All+1
end if
'debug(Cyc_Time)

for Cyc = 1 to Cyc_Time			'生成有分页内容的

	if Search_Count=0 then
		Search_Count_Max=0
	elseif Search_Count<Page_Size_All then
		Search_Count_Max="1 - "&Search_Count
	elseif Page_Size_All*(Cyc)+1<Search_Count then
		Search_Count_Max=Page_Size_All*(Cyc-1)+1 &" - "& Page_Size_All*(Cyc)
	else
		Search_Count_Max=Page_Size_All*(Cyc-1)+1 &" - "& Search_Count
	end if
	'-----读取模板内容-----
	sql="select * from [Templet] where SD_templet_default=1 and SD_templet_type='Search'"
	rs.open sql,conn,1,1
	if not rs.eof then
		Templet_content = rs("SD_templet_content")
	else
		response.Write("未设置默认模板或参数错误!")
		response.End()
	end if
	rs.close
	'-----结束模板读取-----
	'模板嵌套调用替换
	while cint(InStr(Templet_content,"{$Templet("))>0
		Templet_str=mid(Templet_content,cint(InStr(Templet_content,"{$Templet("))+2,cint(InStr(Templet_content,")Templet$}"))-cint(InStr(Templet_content,"{$Templet("))-2)
		Templet_content=replace(Templet_content,"{$"&Templet_str&")Templet$}",SD_Templet_change(replace(Templet_str,"Templet(","")))
	wend
	'基本标签替换
	Templet_content=replace(Templet_content,"{$HomePage$}","{$SiteUrl$}{$Directory$}{$Dir_Index$}index.html")
	Templet_content=replace(Templet_content,"{$Directory$}",Directory)
	Templet_content=replace(Templet_content,"{$Dir_Index$}",Dir_Index)
	Templet_content=replace(Templet_content,"{$SearchUrl$}",SiteUrl&"Search.asp")
	Templet_content=replace(Templet_content,"{$SiteUrl$}",SiteUrl)
	Templet_content=replace(Templet_content,"{$SiteName$}",SiteName)
	Templet_content=replace(Templet_content,"{$SiteLogo$}",SiteLogo)
	Templet_content=replace(Templet_content,"{$SiteBanner$}",SiteBanner)
	Templet_content=replace(Templet_content,"{$SiteMail$}",SiteMail)
	Templet_content=replace(Templet_content,"{$Search_Count$}",Search_Count)
	Templet_content=replace(Templet_content,"{$Search_Count_Max$}",Search_Count_Max)
	Templet_content=replace(Templet_content,"{$keyWord$}",keyWord)
	Templet_content=replace(Templet_content,"{$Jquery2Search$}",Jquery2Search)
	'函数替换
	while cint(InStr(Templet_content,"{$"))>0
		templet_str=mid(Templet_content,cint(InStr(Templet_content,"{$"))+2,cint(InStr(Templet_content,"$}"))-cint(InStr(Templet_content,"{$"))-2)
		templet_str2 = split(templet_str,"(")
		templet_str3 = replace(templet_str2(1),")","")
		templet_str_l = split(templet_str3,",")
		Select Case templet_str2(0)
			Case "SD_Key_Search":Templet_content=replace(Templet_content,"{$"&templet_str&"$}",SD_Key_Search(templet_str_l(0),Cyc,Cyc_Time,keyWord))
			Case "SD_Soft_List_Text":Templet_content=replace(Templet_content,"{$"&templet_str&"$}",SD_Soft_List_Text(templet_str_l(0)))
			Case "SD_Class_List_Page":Templet_content=replace(Templet_content,"{$"&templet_str&"$}",SD_Class_List_Page(templet_str_l(0)))
			Case "SD_Soft_One":Templet_content=replace(Templet_content,"{$"&templet_str&"$}",SD_Soft_One(templet_str_l(0),templet_str_l(1),templet_str_l(2)))
			Case "SD_Soft_List_Img":Templet_content=replace(Templet_content,"{$"&templet_str&"$}",SD_Soft_List_Img(templet_str_l(0),templet_str_l(1),templet_str_l(2),templet_str_l(3)))
			Case "SD_Soft_List":Templet_content=replace(Templet_content,"{$"&templet_str&"$}",SD_Soft_List(templet_str_l(0),templet_str_l(1),templet_str_l(2),templet_str_l(3),templet_str_l(4)))
			Case else:Templet_content=replace(Templet_content,"{$"&templet_str&"$}","")
		End Select
	wend
	
	file_path = "../"&Directory&Dir_Search&"Search_"&keyWord&"_"&Cyc&".html"
	Set objStream = Server.CreateObject("ADODB.Stream")   
	With objStream
		.Open 
		.Charset = "utf-8"   
		.Position = objStream.Size   
		.WriteText=Templet_content
		.SaveToFile server.mappath(file_path),2
		.Close   
	End With   
	Set objStream = Nothing
	
next
response.Redirect("../"&Directory&Dir_Search&"Search_"&keyWord&"_1.html")
end if
%>

⌨️ 快捷键说明

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