?? 構建你的網站新聞自動發布系統之五.txt
字號:
構建你的網站新聞自動發布系統之五(轉貼)
--------------------------------------------------------------------------------
【天啦】 于 00-4-20 下午 02:00:19 加貼在 Joy ASP ↑:
(三)把新聞代碼插入你的頁面
最好的新聞發布,當然是為網站本身定做的,那樣才能與主頁風格一致,但如此一來,新聞發布系統有缺乏了通用性了,不能移值到別的網站上使用,有得必有失,在這個基礎上關鍵是找一個平行點。綜合來考濾,最好的做法是與頁面分離,那樣就可以不影響網頁的外觀,而也能達到很好的效果,在使用新聞的網頁上我們可以通過放置一條這樣的script語句來調用新聞代碼
《script language="JavaScript"
src="http//xxx.com.cn/special/linux/lnews/autoup.asp"》
大家可以到這里看看效果
現在請大家看看autoup.asp的代碼。
《% @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》廣州市場《/b》《/td》《/tr》"
do while not rs.eof
'廣州市場
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》【更多新聞...】 《/td》《/tr》"
dispmess=dispmess&disp
rs.movefirst
disp=""
count=0
disp="《tr》《td width=100% 》《b》市場風云《/b》《/td》《/tr》"
do while not rs.eof
'市場風云
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》【更多新聞...】 《/td》《/tr》"
dispmess=dispmess&disp
rs.movefirst
disp=""
count=0
disp="《tr》《td width=100% 》《b》IT新聞《/b》《/td》《/tr》"
do while not rs.eof
'IT新聞
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》【更多新聞...】 《/td》《/tr》"
dispmess=dispmess&disp
dispmess=dispmess&"《/table》"
dispmess="document.write('"&dispmess&"')"
%》
《%=dispmess%》
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -