构建你的网站新闻自动发布系统之二

  • 来源: 互联网 作者: 若水   2008-03-17/13:40
  • (一)构建新闻数据库   
    分析一下构成每条新闻的元素,主要由新闻标题,新闻内容,图片地址,连接地
    址,新闻的发布时间组成。而在构建数据库的时候。考虑到处理需要,必需加上新闻
    的ID号,以便识别。再者的话,可以加上点击统计,以便了解读者感性趣的内容。
    access数据库是一个非常适合于开发阶段使用的过度时期数据库,因此。我们构造如
    下的一个新闻数据库(data.mdb)   
    表data   
    news_idlong新闻的编号   
    news_classtext新闻的类别   
    news_class_nametext新闻的类别名   
    news_titletext新闻的标题   
    news_headlogic是否首页显示   
    news_commentcomment新闻的内容   
    news_yeartext新闻的年份   
    news_monthtext新闻的月份   
    news_daytext新闻的内容   
    news_timetext更新时间   
    news_deletelogic删除标志   
      
    按上述的要求建好这个表,当我们经过测试稳定后,就可以把新闻数据库转入
    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"   #p#分页标题#e#
    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"   #p#分页标题#e#
    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》   
      
    好了,下节“添加每天的新闻内容”将为您介绍如何对新闻数据进行处理,请先
    按步骤建立好上面的编程环境



    评论 {{userinfo.comments}}

    {{money}}

    {{question.question}}

    A {{question.A}}
    B {{question.B}}
    C {{question.C}}
    D {{question.D}}
    提交

    驱动号 更多