Sorry!这标签相关参数(如调用新闻条数、截取新闻字数)没有写在后台,自己在代码中按自己所需修改。
本人在这只写代码教程。不懂QQ:35550507
-----------------------------------------------------------------------
第一步:修改标签管理文件Templet_Edit.asp
-----------------------------------------------------------------------
找到以下代码,在后面添加 "并排新闻" "{BPSW}" ,以下为已经添加完的代码。
-----------------------------------------------------------------------
var GeneralLableText=new Array("栏目导航","热点新闻","搜索","高级搜索","推荐新闻","最新新闻","页面标题","站点地图标签","导读图片","滚动新闻","最新图片","友情链接","当前位置","幻灯图片","并排新闻");
var GeneralLableCont=new Array("{ClassNavi}","{HotNews}","{NewsSearch}","{NewsSearchadvance}","{ReNews}","{LastNews}","{PageTitle}","{SiteMap}","{NaviPic}","{Marquee}","{LastPic}","{FriendLink}","{Location}","{Filter}","{BPSW}");
var GeneralLableCont=new Array("{ClassNavi}","{HotNews}","{NewsSearch}","{NewsSearchadvance}","{ReNews}","{LastNews}","{PageTitle}","{SiteMap}","{NaviPic}","{Marquee}","{LastPic}","{FriendLink}","{Location}","{Filter}","{BPSW}");
-----------------------------------------------------------------------
第二步:修改生成首页文件News_MakeIndex.asp
-----------------------------------------------------------------------
在适当位置添加上以下代码(如在“幻灯图片”标签以后)
-----------------------------------------------------------------------
'并排新闻-----开始
Case "{BPSW}"
Dim RsBPSWObj,title,BPSWStr,BPSWi,BPSWii,BPSWNum
BPSWNum=20 '调用新闻数量
Set RsBPSWObj = Conn.Execute("select top "& BPSWNum &" * from news where NewsSBS=true and DelFlag=false and Audit=true order by newsid desc")
if not RsBPSWObj.eof then
BPSWii=0
BPSWStr="<table border='0' width='100%' id='table1' cellspacing='3' cellpadding='0'>"
BPSWStr=BPSWStr&"<tr>"
for BPSWi=1 to BPSWNum
if len(RsBPSWObj("Title"))>=11 then '调用的字数-当字数大于等于11个字时就截取
title=Trim(gotTopic(RsBPSWObj("Title"),22)) '调用的字数-当字数大于等于11个字时就截取-这里为11的双倍22字节
else
title=RsBPSWObj("Title")
end if
BPSWii=BPSWii+1
if BPSWii mod 2 = 0 then
BPSWStr=BPSWStr&"<td> <a href="&GetUrl&RsBPSWObj("NewsPath")&RsBPSWObj("filename")&"."&RsBPSWObj("FileExtName")&" target=_blank>"&CovtTitle(title)&"</a></td>"
else
BPSWStr=BPSWStr&"</tr>"
BPSWStr=BPSWStr&"<tr>"
BPSWStr=BPSWStr&"<td> <a href="&GetUrl&RsBPSWObj("NewsPath")&RsBPSWObj("filename")&"."&RsBPSWObj("FileExtName")&" target=_blank>"&CovtTitle(title)&"</a></td>"
end if
'BPSWStr=BPSWStr&"<td> <a href="&GetUrl&RsBPSWObj("NewsPath")&RsBPSWObj("filename")&"."&RsBPSWObj("FileExtName")&" target=_blank>"&CovtTitle(title)&"</a></td>"
RsBPSWObj.MoveNext
next
BPSWStr=BPSWStr&"</table>"
else
BPSWStr="现在还没有满足条件的并排新闻,请添加。"
End if
RsBPSWObj.close
set RsBPSWObj=nothing
TempletContent = Replace(TempletContent,"{BPSW}",BPSWStr)
'并排新闻-----结束
Case "{BPSW}"
Dim RsBPSWObj,title,BPSWStr,BPSWi,BPSWii,BPSWNum
BPSWNum=20 '调用新闻数量
Set RsBPSWObj = Conn.Execute("select top "& BPSWNum &" * from news where NewsSBS=true and DelFlag=false and Audit=true order by newsid desc")
if not RsBPSWObj.eof then
BPSWii=0
BPSWStr="<table border='0' width='100%' id='table1' cellspacing='3' cellpadding='0'>"
BPSWStr=BPSWStr&"<tr>"
for BPSWi=1 to BPSWNum
if len(RsBPSWObj("Title"))>=11 then '调用的字数-当字数大于等于11个字时就截取
title=Trim(gotTopic(RsBPSWObj("Title"),22)) '调用的字数-当字数大于等于11个字时就截取-这里为11的双倍22字节
else
title=RsBPSWObj("Title")
end if
BPSWii=BPSWii+1
if BPSWii mod 2 = 0 then
BPSWStr=BPSWStr&"<td> <a href="&GetUrl&RsBPSWObj("NewsPath")&RsBPSWObj("filename")&"."&RsBPSWObj("FileExtName")&" target=_blank>"&CovtTitle(title)&"</a></td>"
else
BPSWStr=BPSWStr&"</tr>"
BPSWStr=BPSWStr&"<tr>"
BPSWStr=BPSWStr&"<td> <a href="&GetUrl&RsBPSWObj("NewsPath")&RsBPSWObj("filename")&"."&RsBPSWObj("FileExtName")&" target=_blank>"&CovtTitle(title)&"</a></td>"
end if
'BPSWStr=BPSWStr&"<td> <a href="&GetUrl&RsBPSWObj("NewsPath")&RsBPSWObj("filename")&"."&RsBPSWObj("FileExtName")&" target=_blank>"&CovtTitle(title)&"</a></td>"
RsBPSWObj.MoveNext
next
BPSWStr=BPSWStr&"</table>"
else
BPSWStr="现在还没有满足条件的并排新闻,请添加。"
End if
RsBPSWObj.close
set RsBPSWObj=nothing
TempletContent = Replace(TempletContent,"{BPSW}",BPSWStr)
'并排新闻-----结束
-----------------------------------------------------------------------
第三步:修改生成大小类文件News_Refreshclass.asp
-----------------------------------------------------------------------
在适当位置添加上以下代码(如在“幻灯图片”标签以后)
-----------------------------------------------------------------------
'并排新闻-----开始
Case "{BPSW}"
Dim RsBPSWObj,title,BPSWStr,BPSWi,BPSWii,BPSWNum
BPSWNum=20 '调用并排新闻数量
Set RsClassObj = Server.CreateObject("ADODB.RecordSet")
RsClassObj.Open "Select * from NewsClass where Classid="& ClassID,Conn
if RsClassObj("ChildClassTF") = true then
ChildClassID = RsClassObj("ClassID") & ChildClassIDList(RsClassObj("ClassID"))
Set RsBPSWObj = Conn.Execute("select top "& BPSWNum &" * from news,newsclass where News.ClassID in (" & ChildClassID & ") and News.ClassID=NewsClass.ClassID and News.NewsSBS=true and News.DelFlag=false and News.Audit=true order by News.newsid desc")
else
ChildClassID = RsClassObj("ClassID")
Set RsBPSWObj = Conn.Execute("select top "& BPSWNum &" * from news,newsclass where News.ClassID=" & ChildClassID & " and News.ClassID=NewsClass.ClassID and News.NewsSBS=true and News.DelFlag=false and News.Audit=true order by News.newsid desc")
end if
if not RsBPSWObj.eof then
BPSWii=0
BPSWStr="<table border='0' width='100%' id='table1' cellspacing='3' cellpadding='0' align=center>"
BPSWStr=BPSWStr&"<tr>"
for BPSWi=1 to BPSWNum
if len(RsBPSWObj("Title"))>=11 then '调用的字数-当字数大于等于11个字时就截取
title=Trim(gotTopic(RsBPSWObj("Title"),22)) '调用的字数-当字数大于等于11个字时就截取-这里为11的双倍22字节
else
title=RsBPSWObj("Title")
end if
BPSWii=BPSWii+1
if BPSWii mod 2 = 0 then
BPSWStr=BPSWStr&"<td><a href="&GetUrl&RsBPSWObj("NewsPath")&RsBPSWObj("filename")&"."&RsBPSWObj("FileExtName")&" target=_blank>"&CovtTitle(title)&"</a></td>"
else
BPSWStr=BPSWStr&"</tr>"
BPSWStr=BPSWStr&"<tr>"
BPSWStr=BPSWStr&"<td><a href="&GetUrl&RsBPSWObj("NewsPath")&RsBPSWObj("filename")&"."&RsBPSWObj("FileExtName")&" target=_blank>"&CovtTitle(title)&"</a></td>"
end if
RsBPSWObj.MoveNext
next
BPSWStr=BPSWStr&"</table>"
else
BPSWStr="现在还没有满足条件的并排新闻,请添加。"
End if
RsBPSWObj.close
set RsBPSWObj=nothing
TempletContent = Replace(TempletContent,"{BPSW}",BPSWStr)
'并排新闻-----结束
Case "{BPSW}"
Dim RsBPSWObj,title,BPSWStr,BPSWi,BPSWii,BPSWNum
BPSWNum=20 '调用并排新闻数量
Set RsClassObj = Server.CreateObject("ADODB.RecordSet")
RsClassObj.Open "Select * from NewsClass where Classid="& ClassID,Conn
if RsClassObj("ChildClassTF") = true then
ChildClassID = RsClassObj("ClassID") & ChildClassIDList(RsClassObj("ClassID"))
Set RsBPSWObj = Conn.Execute("select top "& BPSWNum &" * from news,newsclass where News.ClassID in (" & ChildClassID & ") and News.ClassID=NewsClass.ClassID and News.NewsSBS=true and News.DelFlag=false and News.Audit=true order by News.newsid desc")
else
ChildClassID = RsClassObj("ClassID")
Set RsBPSWObj = Conn.Execute("select top "& BPSWNum &" * from news,newsclass where News.ClassID=" & ChildClassID & " and News.ClassID=NewsClass.ClassID and News.NewsSBS=true and News.DelFlag=false and News.Audit=true order by News.newsid desc")
end if
if not RsBPSWObj.eof then
BPSWii=0
BPSWStr="<table border='0' width='100%' id='table1' cellspacing='3' cellpadding='0' align=center>"
BPSWStr=BPSWStr&"<tr>"
for BPSWi=1 to BPSWNum
if len(RsBPSWObj("Title"))>=11 then '调用的字数-当字数大于等于11个字时就截取
title=Trim(gotTopic(RsBPSWObj("Title"),22)) '调用的字数-当字数大于等于11个字时就截取-这里为11的双倍22字节
else
title=RsBPSWObj("Title")
end if
BPSWii=BPSWii+1
if BPSWii mod 2 = 0 then
BPSWStr=BPSWStr&"<td><a href="&GetUrl&RsBPSWObj("NewsPath")&RsBPSWObj("filename")&"."&RsBPSWObj("FileExtName")&" target=_blank>"&CovtTitle(title)&"</a></td>"
else
BPSWStr=BPSWStr&"</tr>"
BPSWStr=BPSWStr&"<tr>"
BPSWStr=BPSWStr&"<td><a href="&GetUrl&RsBPSWObj("NewsPath")&RsBPSWObj("filename")&"."&RsBPSWObj("FileExtName")&" target=_blank>"&CovtTitle(title)&"</a></td>"
end if
RsBPSWObj.MoveNext
next
BPSWStr=BPSWStr&"</table>"
else
BPSWStr="现在还没有满足条件的并排新闻,请添加。"
End if
RsBPSWObj.close
set RsBPSWObj=nothing
TempletContent = Replace(TempletContent,"{BPSW}",BPSWStr)
'并排新闻-----结束

