(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"%
"The!--#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 "/" "/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 Situation "/" "/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 "/" "/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& "The/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 finished, the last one, is the details of the news show.
When the user clicks on the headline, he opens the Disp.asp file and uses the Get method to pass the arguments through, and we look at the disp.asp file contents.
% @language = "VBScript"%
"The!--#include virtual="/news/data/data.inc "
《%
Set rs = Server.CreateObject ("ADODB.") Recordset ")
Sql= "SELECT * from Data where CSTR (news_id) = '" &cstr (Request.QueryString ("news_id")) & "'"
Rs.Open sql,conn,3,2
%》
"HTML"
"Head"
"Meta http-equiv=" Content-type "content=" text/html; charset=gb2312 ""
"title" "/title"
"/head"
"Body topmargin=" 8 "leftmargin=" 8 "
"Div align=" Center "center"