<!-- #include file="../../inc/html_clear.asp" -->
<%Server.ScriptTimeOut=1000000%>
<%'容错处理
function article_to_html(a_id,a_ppid)
On Error Resume Next
%>

<% '读取模板内容
Set fso=Server.CreateObject("Scripting.FileSystemObject") 
Set htmlwrite=fso.OpenTextFile(Server.MapPath("/model/article_model.html")) 
replace_code=htmlwrite.ReadAll() 
htmlwrite.close 
%>


<%'网站基本信息内容读取替换
set rs=server.createobject("adodb.recordset")
sql="select web_name,web_url,web_image,web_copyright,web_tel,web_person,web_email from web_settings"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
web_name=rs("web_name")
web_url=rs("web_url")
web_image=rs("web_image")
web_copyright=rs("web_copyright")
web_tel=rs("web_tel")
web_person=rs("web_person")
web_email=rs("web_email")
end if
rs.close
set rs=nothing



'顶部导航列表读取替换
set rs=server.createobject("adodb.recordset")
sql="select [number],[id] from web_menu_type order by [order]"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
do while not rs.eof
web_menu=web_menu&""
set rs_menu=server.createobject("adodb.recordset")
sql="select top "&rs("number")&" [name],[url] from web_menu where [position]="&rs("id")&" order by [order] "
rs_menu.open(sql),cn,1,1
if not rs_menu.eof and not rs_menu.bof then
for i= 1 to rs_menu.recordcount
if i=1  or i=rs_menu.recordcount/2+1 then
web_menu=web_menu&"<li><a href='"&rs_menu("url")&"' title='"&rs_menu("name")&"' target='_self'>"&left(rs_menu("name"),4)&"</a></li>"
else
web_menu=web_menu&"<li><a href='"&rs_menu("url")&"' title='"&rs_menu("name")&"' target='_self'>"&left(rs_menu("name"),4)&"</a></li>"
end if
if i=rs_menu.recordcount/2 then
web_menu=web_menu&""
end if
rs_menu.movenext
next
else
web_menu=web_menu&"无数据"
end if
rs_menu.close
set rs_menu=nothing

web_menu=web_menu&""
rs.movenext
loop
else
web_menu=web_menu&"无数据"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_menu$",web_menu)



'二层导航列表读取替换
set rs=server.createobject("adodb.recordset")
sql1="select top 12 name,folder from category where ppid=1 and id > 48 order by id asc"
rs.open(sql1),cn,1,1
if not rs.eof and not rs.bof then
web_menus=web_menus&""
do while not rs.eof 
web_menus=web_menus&"<li><a href='/"&rs("folder")&"/index.html' title='"&rs("name")&"' target='_self'>"&left(rs("name"),4)&"</a></li>"
rs.movenext
loop
web_menus=web_menus&""
else
web_menus=web_menus&"无数据"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_menus$",web_menus)



'二级导航列表读取替换
set rs=server.createobject("adodb.recordset")
sql="select top 12 [id],[name],[folder],[pid] from [category] where pid=36 and ppid=2 order by id"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
for i=1 to rs.recordcount

folder_name_0=rs("folder")
'ppid=2
set rs_1=server.createobject("adodb.recordset")
sql="select [folder] from [category] where [id]="&rs("pid")&" and ppid=1"
rs_1.open(sql),cn,1,1
if not rs_1.eof then

folder_name_1=rs_1("folder")

if folder_name_1<>"" and  folder_name_0<>"" then

Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
If Fso.FolderExists(Server.MapPath("/"&folder_name_0))=true then
folder_path="/"&folder_name_0
else
folder_path="/html/"&rs("folder")
end if

else
folder_path="/html/"&rs("folder")
end if

end if
rs_1.close
set rs_1=nothing

if i=1 then
web_menuss=web_menuss&"<li><a href='"&folder_path&"/index.html' title='"&rs("name")&"' target='_self'>"&rs("name")&"</a></li>"
else
web_menuss=web_menuss&"<li><a href='"&folder_path&"/index.html' title='"&rs("name")&"' target='_self'>"&rs("name")&"</a></li>"
end if
rs.movenext
next
else
web_menuss=web_menuss&"无数据"
end if 
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_menuss$",web_menuss)



'站点推广①列表读取替换
set rs=server.createobject("adodb.recordset")
sql="select top 5 [name],[url] from web_keywords where hot_yes=1 order by [time] asc"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
do while not rs.eof
hotkeys_url=rs("url")
if rs("url")="" then
hotkeys_url=""
end if
web_hotsearch=web_hotsearch&"<a href='"&hotkeys_url&"' target='_blank' title='"&rs("name")&"'>"&left(rs("name"),6)&"</a>"
rs.movenext
loop
else
web_hotsearch=web_hotsearch&"无数据"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_hotsearch$",web_hotsearch)



'站内公告列表读取替换
set rs=server.createobject("adodb.recordset")
sql="select top 1 title,image,[url],memo from [web_special] where index_push=1 and id=17 order by [time] desc"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
web_gonggao_list=web_gonggao_list&""
web_gonggao_list=web_gonggao_list&"<a href='"&rs("url")&"' title='"&rs("title")&"' target='_blank'><font color=#333333>"&left(rs("title"),27)&"</font></a>"
web_gonggao_list=web_gonggao_list&""
else
web_gonggao_list=web_gonggao_list&"无数据"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_gonggao_list$",web_gonggao_list)



'站点推广②列表读取替换
set rs=server.createobject("adodb.recordset")
sql="select top 20 [name],[url] from web_keywords where index_yes=1 order by [time] asc"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
do while not rs.eof
hotkeys_url=rs("url")
if rs("url")="" then
hotkeys_url=""
end if
web_indexsearch=web_indexsearch&"<div><a href='"&hotkeys_url&"' target='_blank' title='"&rs("name")&"'><font color=#333333>"&left(rs("name"),15)&"</font></a></div>"
rs.movenext
loop
else
web_indexsearch=web_indexsearch&"无数据"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_indexsearch$",web_indexsearch)



'新进企业列表读取替换
set rs=server.createobject("adodb.recordset")
sql="select top 20 name,address,file_path,tel from [web_com]  where view_yes=1 order by [time] desc"

rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then

for i= 1 to rs.recordcount
if i=1 then
web_xjcom_list=web_xjcom_list&""
else
web_xjcom_list=web_xjcom_list&""
end if
web_xjcom_list=web_xjcom_list&"<div><a href='"&rs("file_path")&"' target='_blank' title='"&rs("name")&"'>"&left(rs("name"),20)&"</a></div>"
web_xjcom_list=web_xjcom_list&""
web_xjcom_list=web_xjcom_list&""
web_xjcom_list=web_xjcom_list&""
rs.movenext
next
else
web_xjcom_list=web_xjcom_list&"无数据"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_xjcom_list$",web_xjcom_list)



'行业资讯列表读取替换
set rs=server.createobject("adodb.recordset")
sql="select top 1 id,title,content,file_path,[url],time from [article]  where view_yes=1 and index_push=1 and cid='49' order by [time] desc"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
rs_url=""
if rs("url")<>"" then
rs_url=rs("url")
else
rs_url=rs("file_path")
end if 
web_hangyezixun_list=web_hangyezixun_list&"<li><a href='"&rs_url&"' title='"&rs("title")&"'  target='_blank'>"&left(rs("title"),20)&"</li>"
web_hangyezixun_list=web_hangyezixun_list&""
else
web_hangyezixun_list=web_hangyezixun_list&"无数据"
end if
rs.close
set rs=nothing

set rs=server.createobject("adodb.recordset")
sql="select top 9 title,content,file_path,[url],time from [article]  where [id] not in (select top 1 [id] from [article]  where view_yes=1 and index_push=1 and cid='49' order by [time] desc) and view_yes=1 and cid='49' order by [time] desc"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
web_hangyezixun_list=web_hangyezixun_list&""
do while not rs.eof 
rs_url=""
if rs("url")<>"" then
rs_url=rs("url")
else
rs_url=rs("file_path")
end if 
web_hangyezixun_list=web_hangyezixun_list&"<li><a href='"&rs_url&"' target='_blank' title='"&rs("title")&"'>"&left(rs("title"),20)&"</a></li>"
rs.movenext
loop
web_hangyezixun_list=web_hangyezixun_list&""
else
web_hangyezixun_list=web_hangyezixun_list&"无数据"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_hangyezixun_list$",web_hangyezixun_list)



'企业动态列表读取替换
set rs=server.createobject("adodb.recordset")
sql="select top 1 id,title,content,file_path,[url],time from [article]  where view_yes=1 and index_push=1 and cid='53' order by [time] desc"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
rs_url=""
if rs("url")<>"" then
rs_url=rs("url")
else
rs_url=rs("file_path")
end if 
web_qiyedongtai_list=web_qiyedongtai_list&"<li><a href='"&rs_url&"' title='"&rs("title")&"'  target='_blank'>"&left(rs("title"),20)&"</li>"
web_qiyedongtai_list=web_qiyedongtai_list&""
else
web_qiyedongtai_list=web_qiyedongtai_list&"无数据"
end if
rs.close
set rs=nothing

set rs=server.createobject("adodb.recordset")
sql="select top 9 title,content,file_path,[url],time from [article]  where [id] not in (select top 1 [id] from [article]  where view_yes=1 and index_push=1 and cid='53' order by [time] desc) and view_yes=1 and cid='53' order by [time] desc"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
web_qiyedongtai_list=web_qiyedongtai_list&""
do while not rs.eof 
rs_url=""
if rs("url")<>"" then
rs_url=rs("url")
else
rs_url=rs("file_path")
end if 
web_qiyedongtai_list=web_qiyedongtai_list&"<li><a href='"&rs_url&"' target='_blank' title='"&rs("title")&"'>"&left(rs("title"),20)&"</a></li>"
rs.movenext
loop
web_qiyedongtai_list=web_qiyedongtai_list&""
else
web_qiyedongtai_list=web_qiyedongtai_list&"无数据"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_qiyedongtai_list$",web_qiyedongtai_list)



'热门点击列表读取替换
set rs=server.createobject("adodb.recordset")
sql="select top 10 [title],[file_path],[hit] from [article] where view_yes=1 and [hit]<>0  order by [hit] desc"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
web_hit_link=web_hit_link&""
i=0
for c=1 to 10
i=i+1
web_hit_link=web_hit_link&"<li class='a_list_"&i&"'><a href='"&rs("file_path")&"' target='_blank' title='"&rs("title")&"'>"&left(rs("title"),20)&"</a></li>"
rs.movenext
next

web_hit_link=web_hit_link&""
else
web_hit_link=web_hit_link&"无数据"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_hit_link$",web_hit_link)



'招商专区列表读取替换
set rs=server.createobject("adodb.recordset")
sql="select [name],[url],[memo] from web_gov where view_yes=1 order by [order]"
rs.open(sql),cn,1,1
if not rs.eof then
web_zhaoshang_list=web_zhaoshang_list&""
do while not rs.eof 
web_zhaoshang_list=web_zhaoshang_list&"<li><a href='"&rs("url")&"' target='_blank' title='"&rs("name")&"'><font color='#"&rs("memo")&"'>"&left(rs("name"),20)&"</font></a></li>"
rs.movenext
loop
web_zhaoshang_list=web_zhaoshang_list&""
else
web_zhaoshang_list=web_zhaoshang_list&"无数据"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_zhaoshang_list$",web_zhaoshang_list)



'友情链接列表读取替换
set rs=server.createobject("adodb.recordset")
sql="select [name],[url] from web_link where view_yes=1 order by [time] asc"
rs.open(sql),cn,1,1
if not rs.eof then
web_links_list=web_links_list&""
do while not rs.eof 
web_links_list=web_links_list&"<a href='"&rs("url")&"' target='_blank' title='"&rs("name")&"'>"&left(rs("name"),12)&"</a>"
rs.movenext
loop
web_links_list=web_links_list&""
else
web_links_list=web_links_list&"无数据"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_links_list$",web_links_list)
%>



<%'文章内容读取替换列表
set rs=server.createobject("adodb.recordset")
sql="select * from [article] where [id]="&a_id&""
rs.open(sql),cn,1,3
if not rs.eof and not rs.bof then
article_title=rs("title")
article_keywords=rs("keywords")
article_description=rs("description")
article_from_url=rs("from_url")
article_time=rs("time")
article_from_name=rs("from_name")
article_content=rs("content")
article_author=rs("author")
article_times=""&year(rs("time"))&"年-"&month(rs("time"))&"月-"&day(rs("time"))&"日"


if rs("from_name")="" then
article_from_name=web_name
end if


if rs("from_url")="" then

set rs_url=server.createobject("adodb.recordset")
sql="select url from web_article_author where [name]='"&article_from_name&"'"
rs_url.open(sql),cn,1,1
if not rs_url.eof then
article_from_url=rs_url("url")
else
article_from_url="/"
end if
rs_url.close
set rs_url=nothing

end if


article_short="<div class='a_short'>&nbsp;&nbsp;&nbsp;&nbsp;<span class='fontb arial'>内容提要：</span></a>"&rs("description")&"</div>"
if rs("description")="" then
article_short=""
end If

article_tiyao=""&left(rs("content"),172)&""
if rs("content")="" then
article_tiyao=""
end If


article_titlee=""&left(rs("title"),28)&""
if rs("title")="" then
article_titlee=""
end If

replace_code=replace(replace_code,"$web_name$",web_name)
replace_code=replace(replace_code,"$web_url$",web_url)
replace_code=replace(replace_code,"$web_image$",web_image)
replace_code=replace(replace_code,"$web_copyright$",web_copyright)
replace_code=replace(replace_code,"$web_tel$",web_tel)
replace_code=replace(replace_code,"$web_person$",web_person)
replace_code=replace(replace_code,"$web_email$",web_email)
replace_code=replace(replace_code,"$web_menu$",web_menu)
replace_code=replace(replace_code,"$web_menus$",web_menus)
replace_code=replace(replace_code,"$web_hotsearch$",web_hotsearch)
replace_code=replace(replace_code,"$web_indexsearch$",web_indexsearch)
replace_code=replace(replace_code,"$web_xjcom_list$",web_xjcom_list)
replace_code=replace(replace_code,"$web_hit_link$",web_hit_link)
replace_code=replace(replace_code,"$web_zhaoshang_list$",web_zhaoshang_list)
replace_code=replace(replace_code,"$web_links_list$",web_links_list)

replace_code=replace(replace_code,"$article_id$",a_id) 
replace_code=replace(replace_code,"$article_title$",article_title)
replace_code=replace(replace_code,"$article_titlee$",article_titlee)
replace_code=replace(replace_code,"$article_keywords$",article_keywords)
replace_code=replace(replace_code,"$article_description$",article_description)
replace_code=replace(replace_code,"$article_from_url$",article_from_url)
replace_code=replace(replace_code,"$article_time$",article_time)
replace_code=replace(replace_code,"$article_times$",article_times)
replace_code=replace(replace_code,"$article_from_name$",article_from_name)
replace_code=replace(replace_code,"$article_short$",article_short)
replace_code=replace(replace_code,"$article_tiyao$",article_tiyao)
replace_code=replace(replace_code,"$article_content$",article_content)
replace_code=replace(replace_code,"$article_author$",article_author)


'标题分类读取替换列表
set rs_0=server.createobject("adodb.recordset")
sql="select [id],[pid],[ppid],[name],[folder] from [category] where [id]="&rs("cid")&" and ppid=1"
rs_0.open(sql),cn,1,1
ClassName=rs_0("name")

if rs("pid")<>"" then
set rs_1=server.createobject("adodb.recordset")
sql="select [id],[pid],[ppid],[name],[folder] from [category] where [id]="&rs("pid")&" and ppid=2"
rs_1.open(sql),cn,1,1
ClassName_1=rs_1("name")
end if
if rs("ppid")<>"" then
set rs_2=server.createobject("adodb.recordset")
sql="select [id],[pid],[ppid],[name],[folder] from [category] where [id]="&rs("ppid")&" and ppid=3"
rs_2.open(sql),cn,1,1
ClassName_2=rs_2("name")
end if


replace_code=replace(replace_code,"$ClassName$",ClassName)

 

'您现在的位置读取替换
set rs_0=server.createobject("adodb.recordset")
sql="select [id],[pid],[ppid],[name],[folder] from [category] where [id]="&rs("cid")&" and ppid=1"
rs_0.open(sql),cn,1,1
folder_name=rs_0("folder")

if rs("pid")<>"" then
set rs_1=server.createobject("adodb.recordset")
sql="select [id],[pid],[ppid],[name],[folder] from [category] where [id]="&rs("pid")&" and ppid=2"
rs_1.open(sql),cn,1,1
folder_name_1=rs_1("folder")
end if
if rs("ppid")<>"" then
set rs_2=server.createobject("adodb.recordset")
sql="select [id],[pid],[ppid],[name],[folder] from [category] where [id]="&rs("ppid")&" and ppid=3"
rs_2.open(sql),cn,1,1
folder_name_2=rs_2("folder")
end if



replace_code=replace(replace_code,"$folder_Name$",folder_Name)

'----------------------
if folder_name<>"" then
Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
If Fso.FolderExists(Server.MapPath("/"&folder_name))=true then
folder_path="/"&folder_name&"/"
else
folder_path="/html/"&rs_0("id")&"/"
end if

else
folder_path="/html/"&rs_0("id")&"/"
end if
category_position1="<a href='"&folder_path&"index.html'>"&rs_0("name")&"</a>"


if folder_name_1<>"" then
Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
If Fso.FolderExists(Server.MapPath("/"&folder_name&"/"&folder_name_1))=true then
folder_path="/"&folder_name&"/"&folder_name_1&"/"
else
folder_path="/html/"&rs_1("id")&"/"
end if

else
folder_path="/html/"&rs_1("id")&"/"
end if
category_position2=" > <a href='"&folder_path&"index.html'>"&rs_1("name")&"</a>"


if folder_name_2<>"" then
Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
If Fso.FolderExists(Server.MapPath("/"&folder_name&"/"&folder_name_1&"/"&folder_name_2))=true then
folder_path="/"&folder_name&"/"&folder_name_1&"/"&folder_name_2&"/"
else
folder_path="/html/"&rs_2("id")&"/"
end if

else
folder_path="/html/"&rs_2("id")&"/"
end if
category_position3=" > <a href='"&folder_path&"/index.html'>"&rs_2("name")&"</a>"

if rs("ppid")<>"" then
category_position=category_position1&category_position2&category_position3
end if
if rs("ppid")="" and rs("pid")<>"" then
category_position=category_position1&category_position2
end if
if rs("ppid")="" and rs("pid")="" and rs("cid")<>"" then
category_position=category_position1
end if
replace_code=replace(replace_code,"$category_position$",category_position)



'标题名称读取替换列表
set rs_0=server.createobject("adodb.recordset")
sql="select [id],[pid],[ppid],[name],[folder] from [category] where [id]="&rs("cid")&" and ppid=1"
rs_0.open(sql),cn,1,1
folder_name=rs_0("folder")

if rs("pid")<>"" then
set rs_1=server.createobject("adodb.recordset")
sql="select [id],[pid],[ppid],[name],[folder] from [category] where [id]="&rs("pid")&" and ppid=2"
rs_1.open(sql),cn,1,1
folder_name_1=rs_1("folder")
end if
if rs("ppid")<>"" then
set rs_2=server.createobject("adodb.recordset")
sql="select [id],[pid],[ppid],[name],[folder] from [category] where [id]="&rs("ppid")&" and ppid=3"
rs_2.open(sql),cn,1,1
folder_name_2=rs_2("folder")
end if

'----------------------
if folder_name<>"" then
Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
If Fso.FolderExists(Server.MapPath("/"&folder_name))=true then
folder_path="/"&folder_name&"/"
else
folder_path="/html/"&rs_0("id")&"/"
end if

else
folder_path="/html/"&rs_0("id")&"/"
end if
category_title1="<a href='"&folder_path&"'>"&rs_0("name")&"</a>"


if folder_name_1<>"" then
Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
If Fso.FolderExists(Server.MapPath("/"&folder_name&"/"&folder_name_1))=true then
folder_path="/"&folder_name&"/"&folder_name_1&"/"
else
folder_path="/html/"&rs_1("id")&"/"
end if

else
folder_path="/html/"&rs_1("id")&"/"
end if
category_title2=" > <a href='"&folder_path&"'>"&rs_1("name")&"</a>"


if folder_name_2<>"" then
Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
If Fso.FolderExists(Server.MapPath("/"&folder_name&"/"&folder_name_1&"/"&folder_name_2))=true then
folder_path="/"&folder_name&"/"&folder_name_1&"/"&folder_name_2&"/"
else
folder_path="/html/"&rs_2("id")&"/"
end if

else
folder_path="/html/"&rs_2("id")&"/"
end if
category_title3=" > <a href='"&folder_path&"'>"&rs_2("name")&"</a>"

if rs("ppid")<>"" then
category_title=category_title1&category_title2&category_title3
end if
if rs("ppid")="" and rs("pid")<>"" then
category_title=category_title1&category_title2
end if
if rs("ppid")="" and rs("pid")="" and rs("cid")<>"" then
category_title=category_title1
end if
replace_code=replace(replace_code,"$category_title$",category_title)



'将文件名写入数据库
rs("file_path")=filepath
rs.update
end if 
rs.close
set rs=nothing



'文章标题读取替换列表
set rs=server.createobject("adodb.recordset")
sql="select top 1 [title],[keywords],[file_path] from [article] where [id]="&a_id&"  and view_yes=1 order by [id] "
rs.open(sql),cn,1,1
article_bt=article_bt&""
if not rs.eof and not rs.bof then
article_bt=article_bt&"<a href='"&rs("file_path")&"' target='_blank' title='"&rs("title")&"'>"&left(rs("title"),42)&"</a>"
else
article_bt=article_bt&""
end if
article_bt=article_bt&""
rs.close
set rs=nothing

replace_code=replace(replace_code,"$article_bt$",article_bt)



'文章标签读取替换列表
set rs=server.createobject("adodb.recordset")
sql="select top 1 [title],[keywords],[file_path] from [article] where [id]="&a_id&"  and view_yes=1 order by [id] "
rs.open(sql),cn,1,1
article_tags=article_tags&""
if not rs.eof and not rs.bof then
article_tags=article_tags&"<a href='"&rs("file_path")&"' target='_blank' title='"&rs("title")&"'>"&left(rs("keywords"),42)&"</a>"
else
article_tags=article_tags&""
end if
article_tags=article_tags&""
rs.close
set rs=nothing

replace_code=replace(replace_code,"$article_tags$",article_tags)



'上一篇读取替换列表
set rs=server.createobject("adodb.recordset")
sql="select top 1 [title],[file_path] from [article] where [id]>"&a_id&"  and view_yes=1 order by [id] "
rs.open(sql),cn,1,1
article_snext=article_snext&"上一篇："
if not rs.eof and not rs.bof then
article_snext=article_snext&"<a href='"&rs("file_path")&"' target='_blank' title='"&rs("title")&"'>"&left(rs("title"),40)&"</a>"
else
article_snext=article_snext&"没有啦"
end if
article_snext=article_snext&""
rs.close
set rs=nothing

replace_code=replace(replace_code,"$article_snext$",article_snext)



'下一篇读取替换列表
set rs=server.createobject("adodb.recordset")
sql="select top 1 [title],[file_path] from [article] where [id]<"&a_id&"  and view_yes=1 order by [id] "
rs.open(sql),cn,1,1
article_xnext=article_xnext&"下一篇："
if not rs.eof and not rs.bof then
article_xnext=article_xnext&"<a href='"&rs("file_path")&"' target='_blank' title='"&rs("title")&"'>"&left(rs("title"),40)&"</a>"
else
article_xnext=article_xnext&"没有啦"
end if
article_xnext=article_xnext&""
rs.close
set rs=nothing

replace_code=replace(replace_code,"$article_xnext$",article_xnext)
%>

<% '生成静态文件
Set fout = fso.CreateTextFile(Server.MapPath(filepath))
fout.WriteLine replace_code
fout.close
fso.close
set fso=nothing
%>

<%
end function
%>