• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 用ASP構建你的網站新聞發布(三)

    發表于:2007-07-14來源:作者:點擊數: 標簽:
    (三)把新聞代碼插入你的頁面 最好的新聞發布,當然是為網站本身定做的,那樣才能與主頁風格一致,但如此一來,新聞發布系統有缺乏了通用性了,不能移值到別的網站上使用,有得必有失,在這個基礎上關鍵是找一個平行點。綜合來考濾,最好的做法是與頁面分離
    (三)把新聞代碼插入你的頁面
      最好的新聞發布,當然是為網站本身定做的,那樣才能與主頁風格一致,但如此一來,新聞發布系統有缺乏了通用性了,不能移值到別的網站上使用,有得必有失,在這個基礎上關鍵是找一個平行點。綜合來考濾,最好的做法是與頁面分離,那樣就可以不影響網頁的外觀,而也能達到很好的效果,在使用新聞的網頁上我們可以通過放置一條這樣的script語句來調用新聞代碼
     ?。約cript language="JavaScript/" target="_blank">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 i r> 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%>
      通過定制這段代碼,就能制作出符合您要求的網頁顯示格式。
      添加,刪除,顯示都講解完了,最后一項,就是把新聞的詳細內容顯示出來。
      當用戶點擊新聞標題,就打開disp.asp文件,同時使用GET這種方式來把參數傳遞過去,我們看看disp.asp的文件內容
    <% @language="vbscript" %>
    <!--#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>

    <table border="0" width="600" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%"></td>
    </tr>
    <tr>
    <td width="100%" bgcolor="#E6E6E6"><table border="0" width="100%" cellpadding="0">
    <tr>
    <td width="100%" bgcolor="#D2E8FF"><p align="center"><b><%=rs("news_title")%></b></td>
    </tr>
    <tr>
    <td width="100%" bgcolor="#FBFDFF"><table border="0" width="100%" cellpadding="0">
    <tr>
    <td width="100%"><p align="right">(update:<%=rs("news_year")%>-<%=rs("news_month")%>-<%=rs("news_day")%> <%=rs("news_time")%>) </td>
    </tr>
    <tr>
    <td width="100%"><p align="center"><%
    if rs("news_pic")<>"" then
    %> <img src="<%=rs("news_pic")%>"> <%
    end if
    %> </td>
    </tr>
    <tr>
    <td width="100%"><div align="center"><center><table border="0" width="90%" cellpadding="0">
    <tr>
    <td width="100%"><%=rs("news_comment")%>
    </td>
    </tr>
    </table>
    </center></div></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="100%" bgcolor="#D2E8FF"><p align="center"><a href="javascript:window.close()">關閉窗口</td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="100%"></td>
    </tr>
    <tr>
    <td width="100%"></td>
    </tr>
    </table>
    </center></div></a>
    </body>
    </html>
      至此,新聞發布系統已能投入使用,試試看,是不是很方便,很容易就能增添每天的新聞內容了。下一節。我們將為新聞發布系統加入(標題/全文)檢索功能,把它制作得更為完美

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>