(iii) Insert the news code into your page
The best news release, of course, is custom-made for the site itself, so as to be consistent with the homepage style, but this way, the news release system has a lack of versatility, can not be moved to other sites to use, there will be lost, on the basis of the key is to find a parallel point. Comprehensive to test filtration, the best approach is to separate from the page, so you can not affect the appearance of the Web page, but also to achieve a good effect, in the use of news on the page we can put a script like this to invoke the news code
<script language= "JavaScript"
src= "Http//xxx.com.cn/special/linux/lnews/autoup.asp" >
We can see the effect here.
Now let's take a look at the autoup.asp code.
<% @language = "VBScript"%>
<!--#include virtual= "/news/data/data.inc"-->
<%
Set rs = Server.CreateObject ("ADODB.") Recordset ")
Sql= "SELECT * from Data order by news_id Desc"
Rs.Open sql,conn,3,2
If Rs.bof Then
Response.End
End If
dispmess= "<table border=0 width=100% cellpadding=0>"
Rs.movefirst
Disp= ""
Count=0
disp= "<TR><TD width=100% ><b> Guangzhou Market </b></td></tr>"
Do as not rs.eof
' Guangzhou Market
If Cint (RS ("News_class")) =3 Then
disp=disp& "<tr><td width=100% ><a href=http://www.aaaaa.com.cn/news/read.asp?news_id=" &rs ( "news_id") & "Target=_blank>>>" &rs ("News_title") & "</a> <font size=1>" &rs (" News_year ") &"-"&rs (" News_month ") &"-"&rs (" News_day ") &" &rs ("News_time") & "</font >) </td></tr> "
If count>=10 Then ' CLng (Application ("Disp_1"))-1 Then
Exit Do
End If
Count=count+1
End If
Rs.movenext
Loop
disp=disp& "<tr><td width=100% align=right>" more news ... "</td></tr>"
Dispmess=dispmess&disp
Rs.movefirst
Disp= ""
Count=0
disp= "<TR><TD width=100% ><b> Market </b></td></tr>"
Do as not rs.eof
' Market winds
If Cint (RS ("News_class")) =1 Then
disp=disp& "<tr><td width=100% ><a href=http://www.aaaaa.com.cn/news/read.asp?news_id=" &rs ( "news_id") & "Target=_blank>>>" &rs ("News_title") & "</a> <font size=1>" &rs (" News_year ") &"-"&rs (" News_month ") &"-"&rs (" News_day ") &" &rs ("News_time") & "</font >) </td></tr> "
If count>=10 Then ' CLng (Application ("disp_2"))-1 Then
Exit Do
End If
Count=count+1
End If
Rs.movenext
Loop
disp=disp& "<tr><td width=100% align=right>" more news ... "</td></tr>"
Dispmess=dispmess&disp
Rs.movefirst
Disp= ""
Count=0
disp= "<TR><TD width=100% ><b>it News </b></td></tr>"
Do as not rs.eof
' It News
If Cint (RS ("News_class")) =2 Then
disp=disp& "<tr><td width=100% ><a href=http://www.aaaaa.com.cn/news/read.asp?news_id=" &rs ( "news_id") & "Target=_blank>>>" &rs ("News_title") & "</a> <font size=1>" &rs (" News_year ") &"-"&rs (" News_month ") &"-"&rs (" News_day ") &" &rs ("News_time") & "</font >) </td></tr> "
If Count>=50 Then ' CLng (Application ("Disp_3"))-1 Then
Exit Do
End If
Count=count+1
End If
Rs.movenext
Loop
disp=disp& "<tr><td width=100% align=right>" more news ... "</td></tr>"
Dispmess=dispmess&disp
dispmess=dispmess& "</table>"
Dispmess= "document.write" (' &dispmess& ")"
%>
<%=dispmess%>
By customizing this code, you can create a Web page display format that matches your requirements.
Add, delete, show all explained, last item,