Use ASP to build your website press Release (iii)

Source: Internet
Author: User
Tags exit count sql
(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= "&LT;TR&GT;&LT;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= "&LT;TR&GT;&LT;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= "&LT;TR&GT;&LT;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,



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.