(一)構建新聞數據庫 分析一下構成每條新聞的元素,主要由新聞標題,新聞內容,圖片地址,連接地 址,新聞的發布時間組成。而在構建數據庫的時候?紤]到處理需要,必需加上新聞 的ID號,以便識別。再者的話,可以加上點擊統計,以便了解讀者感性趣的內容。 access數據庫是一個非常適合于開發階段使用的過度時期數據庫,因此。我們構造如 下的一個新聞數據庫(data.mdb) 表data news_id long 新聞的編號 news_class text 新聞的類別 news_class_name text 新聞的類別名 news_title text 新聞的標題 news_head logic 是否首頁顯示 news_comment comment 新聞的內容 news_year text 新聞的年份 news_month text 新聞的月份 news_day text 新聞的內容 news_time text 更新時間 news_delete logic 刪除標志 按上述的要求建好這個表,當我們經過測試穩定后,就可以把新聞數據庫轉入 SQL server里面 了。好了,接這下來的這步,我們一起來做一個新聞的管理頁面,為了布局和管理方 便,我們采用 框架結構做出如下的面頁。webadmin.htm框架的主文件。 《html》 《head》 《meta http-equiv="Content-Type" content="text/html; charset=gb2312"》 《title》新聞發布系統管理頁《/title》 《meta name="GENERATOR" content="Microsoft FrontPage 3.0"》 《/head》 《frameset framespacing="0" rows="*,14%"》 《frame name="main" target="footnotes" src="webadmin.asp" scrolling="auto"》 《frame name="footnotes" src="delete.asp" scrolling="auto"》 《noframes》 《body》 《p》This page uses frames, but your browser doesn't support them. 《/p》 《/body》 《/noframes》 《/frameset》 《/html》 而面包含的文件是webadmin.asp這個文件。主要由它提供錄入新聞的每天更新界面, 代碼如下。 《html》 《head》 《meta http-equiv="Content-Type" content="text/html; charset=gb2312"》 《style TYPE="text/css"》 《!-- lh22px {font-size:12px;line-height:22px;font-family:宋體} a { text-decoration: none} body {line-height:18px;font-size:9pt;font-family:宋體} td {line-height:18px;font-size:9pt;font-family:宋體} a:hover {color:#FF0000;text-decoration:none} --》 《/style》 《base target="footnotes"》 《title》新聞發布系統管理頁《/title》 《/head》 《body topmargin="8" leftmargin="8"》 《p align="center"》《font face="楷體_GB2312" size="6" color="#FF0000"》《strong》新聞發布系統WEB管理頁《/strong》《/font》 《/p》 《div align="center"》《center》 《table border="0" width="100%" cellspacing="0" cellpadding="0"》 《tr》 《td width="100%"》《form method="POST" action="addnew.asp"》 《table border="0" width="100%" height="126" cellpadding="0"》 《tr》 《td width="100%" height="9" colspan="2" bgcolor="#E7E7E7"》《div align="center"》《center》《p》《font size="3"》《strong》添加每天新聞內容《/strong》《/font》《/td》 《/tr》 《tr align="center"》 《td width="15%" height="8" bgcolor="#E7E7E7"》《div align="left"》 《p》新聞標題:(必須)《/td》 《td width="85%" height="8" bgcolor="#F9F9F9"》《div align="left"》 《p》《input type="text" name="title" size="73"》《/td》 《/tr》 《tr align="center"》 《td width="15%" height="34" bgcolor="#E7E7E7" valign="top"》《div align="left"》《p》新聞內容:(必須)《/td》 《td width="85%" height="34" bgcolor="#F9F9F9"》《div align="left"》 《p》《textarea rows="13" name="comment" cols="72"》《/textarea》《/td》 《/tr》 《tr align="center"》 《td width="15%" height="17" bgcolor="#E7E7E7"》《div align="left"》 《p》圖片連接地址:《/td》 《td width="85%" height="17" bgcolor="#F9F9F9"》《div align="left"》 《p》《input type="text" name="pic" size="73"》《/td》 《/tr》 《tr align="center"》 《td width="15%" height="17" bgcolor="#E7E7E7"》《div align="left"》 《p》新聞類型:(必須)《/td》 《td width="85%" height="17" bgcolor="#F9F9F9"》《div align="left"》 《p》《select name="class_name" size="1" value="《%=session("class_name")%》"》 《option value="市場風云"》市場風云《/option》 《option value="IT新聞"》IT新聞《/option》 《option value="廣州市場"》廣州市場《/option》 《option value="保 留"》保 留《/option》 《option value="保 留"》!×簟/option》 《/select》《/td》 《/tr》 《tr align="center"》 《td width="15%" height="17" bgcolor="#E7E7E7"》《div align="left"》 《p》是否首頁:《/td》 《td width="85%" height="17" bgcolor="#F9F9F9"》《div align="left"》 《p》《input type="checkbox" name="head" value="YES"》《/td》 《/tr》 《tr align="center"》 《td width="100%" height="16" colspan="2" bgcolor="#E7E7E7"》《div align="center"》《center》《p》《input type="submit" value="提 交" name="B1"》 《input type="reset" value="清 除" name="B2"》《/td》 《/tr》 《/table》 《/form》 《/td》 《/tr》 《/table》 《/center》《/div》《div align="center"》《center》 《table border="0" width="750" cellpadding="0"》 《tr》 《td width="740"》《/td》 《/tr》 《tr》 《td width="740"》《form method="POST" action="set_disp.asp"》 《table border="0" width="100%" cellpadding="0"》 《tr》 《td width="100%" bgcolor="#E7E7E7" colspan="5"》《div align="center"》《center》《p》首頁新聞顯示條數設置《/td》 《/tr》 《tr》 《td width="20%"》《div align="center"》《center》《p》廣州市場 《/td》 《td width="20%"》《div align="center"》《center》《p》市場風云 《/td》 《td width="20%"》《div align="center"》《center》《p》IT新聞 《/td》 《td width="20%"》《div align="center"》《center》《p》!×簟/td》 《td width="20%"》《div align="center"》《center》《p》!×簟/td》 《/tr》 《tr》 《td width="20%"》《div align="center"》《center》《p》《input type="text" name="disp_1" size="10" value="《%=application("disp_1")%》"》《/td》 《td width="20%"》《div align="center"》《center》《p》《input type="text" name="disp_2" size="10" value="《%=application("disp_2")%》"》《/td》 《td width="20%"》《div align="center"》《center》《p》《input type="text" name="disp_3" size="10" value="《%=application("disp_3")%》"》《/td》 《td width="20%"》《div align="center"》《center》《p》《input type="text" name="disp_4" size="10" value="《%=application("disp_4")%》"》《/td》 《td width="20%"》《div align="center"》《center》《p》《input type="text" name="disp_5" size="10" value="《%=application("disp_5")%》"》《/td》 《/tr》 《tr》 《td width="100%" bgcolor="#E7E7E7" colspan="5"》《div align="center"》《center》《p》《input type="submit" value="提 交" name="B1"》 《input type="reset" value="清 除" name="B2"》《/td》 《/tr》 《/table》 《/form》 《/td》 《/tr》 《tr》 《td width="740"》《/td》 《/tr》 《tr》 《td width="740"》《font color="#FF0000"》附注《/font》 新聞標題:即為 顯示在主頁中的連接標題,因此不可省略!/td》 《/tr》 《tr》 《td width="740"》 新聞內容:為點擊標題連接后窗口所打開顯示的新聞內 容,也不允許省略!/td》 《/tr》 《tr》 《td width="740"》 新聞圖片:新聞包含圖片,請把圖片地址連接復制在此, 以便顯示圖片《/td》 《/tr》 《tr》 《td width="740"》 新聞類型:選擇新聞在不同欄目中顯示的位置 《/td》 《/tr》 《tr》 《td width="740"》 是否首頁:如首頁的綜合新聞包需含圖片,請復選此項 《/td》 《/tr》 《tr》 《td width="740"》《p align="center"》《a href="index.asp" target="_parent"》返回新聞首頁《/a》《/td》 《/tr》 《/table》 《/center》《/div》 《/body》 《/html》 好了,下節“添加每天的新聞內容”將為您介紹如何對新聞數據進行處理,請先 按步驟建立好上面的編程環境
|