毕业设计论文-基于php的新闻管理系统-在线新闻网站内容摘要:

(2) 留言表( faq) 留言表包含如下字段:编号( id)、标题( titles)、发布者( who) ,性别( sex) ,籍贯( froms) ,邮箱( ) ,时间( date)、内容( content)、回复( reply)。 如表 24所示: 表 24 faq留言 表 Field Type null key Default Extra id Int not null pri null auto_increment titles Varchar(20) not null null 评论表 发布时间 评论内容 评论者 编号 回复 标题 who Varchar(20) not null null sex Int(2) not null null froms Varchar(20) not null null Varchar(20) not null null content Varchar(20) not null null date Varchar(20) not null null reply Varchar(20) not null null (3)调查表( inquiry) 调查表包含如下字段:选项 ID( id)、内容( name)、点击数 (number)。 如表 21所示: 表 21 inquiry 调查 表 Field Type null key Default Extra id Int not null pri null auto_increment name Varchar(20) not null null number Int(20) not null null (4) 商品种类表( product_sort) 新闻类型表包含如下字段:编号( id)、名称( name)如表 22 所示: 表 22 product_sort 新闻类型表 Field Type null key Default Extra id Int not null pri null auto_increment name Varchar(20) not null null (5)商品信息表( product) 表情评论表包含如下字段:编号( id)、种类号( sort_id)、作者( product_editor)、商品名称( product_name)、图片地址( picture)、出版社( product_publish)、旧价( oldprice)、现价( newprice)、产品介绍( product_introduce)。 如表 25 所 示: 表 25 product 评论表 Field Type null key Default Extra Id Int not null pri null auto_increment sort_id Int not null null Product_name text not null null Product_editor Int not null null picture Int not null null Product_publish Int not null null oldprice Int not null null newprice Int not null null Product_introduce Varchar(200) not null null (6)网站配置表( p_config) 配置表包含如下字段:属性( name)、属性值( values)、备注( remark)、如表25 所示: 表 25 product 评论表 Field Type null key Default Extra name Varchar(20) not null null values Varchar(200) not null null remark text not null null 运行环境 本系统是在 Windows XP 操作平台上运行,利用了 Eclipse for PHP 工具和Wampserver 集成环境开发设计。 3 系统实现 新闻发布展示平台 站点首页 ( 1)功能介绍 作为新闻发布系统,页面应该大方、清新,能突出重点新闻,使人们在第一时间了解时事新闻。 首页除了新闻显示外还包括时间显示, 推荐新闻、后台入口,信息公告栏,行业动态,公司简介友情链接等相关功能。 ( 2)界面实现 如 31图所示。 图 31 首页界面 ( 3) 关键代码 ?php include_once(39。 39。 )。 $sql=SELECT * FROM `p_newsclass` where f_id=0 order by id DESC。 $query=$dbquery($sql)。 while($row_class=$dbfetch_array($query)){ $sm_class[]=array(name=$row_class[name],id=$row_class[id])。 } $smartyassign(sm_class,$sm_class)。 //导航引入 //============== sql=SELECT * FROM p_config。 $query=$dbquery($sql)。 while($row_config=$dbfetch_array($query)){ $sm_config[]=$row_config[values]。 } $smartyassign(sm_config,$sm_config)。 //配置引入 //============== $sql=SELECT * FROM `p_newsbase` order by id DESC limit 5。 $query=$dbquery($sql)。 while($row_news=$dbfetch_array($query)){ $sm_news[]=array(title=$row_news[title],id=$row_news[id])。 } $smartyassign(sm_news,$sm_news)。 //最新新闻 //产品分类 $sql = select * from `product_sort` where 1。 $query = mysql_query($sql)。 while($rs=mysql_fetch_array($query)) { $product_sort[]=array( 39。 id39。 = $rs[39。 id39。 ], 39。 name39。 = $rs[39。 name39。 ], 39。 oldprice39。 = $rs[39。 oldprice39。 ], 39。 newprice39。 = $rs[39。 newprice39。 ] )。 } //行列显示 6 个商品信息 $sql_x = select * from `product` where 1。 $query_x = mysql_query($sql_x)。 $num = mysql_num_rows($query_x)。 pageft($num,8)。 if($firstcount0) $firstcount = 0。 $sql2 = select * from `product` limit .$firstcount.,8。 $query2 = mysql_query($sql2)。 $i = 1。 while($rs2=mysql_fetch_array($query2)){ if(strlen($rs2[39。 product_name39。 ])12){ $books = $rs2[product_name]。 $bookname = substr($books, 0, 8)....。 }else{ $bookname = $rs2[39。 product_name39。 ]。 } $product[] = array( product_name = $bookname, product_hao = $rs2[39。 product_hao39。 ], id = $rs2[39。 id39。 ], picture = $rs2[39。 picture39。 ] )。 if($i%2==0){ $sorts[] = array( layer = $product )。 unset($product)。 } $i++。 } if(!empty($product)) $sorts[] = array( layer = $product )。 $smarty assign(39。 sort39。 ,$sorts)。 $smarty assign(39。 product_sort39。 , $product_sort)。 $smartydisplay()。 ? 子页面介绍 ( 1)功能介绍 本新闻发布系统分为新闻首页、网站调查、产品展示等多个个种类,每个种类都有其独立的页面,用户可以自主设置。 即在可以设置多重父子类的新闻关系,建立两层的导航:即主新闻列表和新闻浏览 ( 2)界面实现 如 32图所示(以新闻列表为例)。 图 32 新闻子界面 ( 3)关键代码: ?PHP include_once (39。 39。 )。 include_once(39。 configs/39。 )。 //引用分页类代码 include ../。 //右侧菜单显示 $sql = select * from `product_sort` where 1。 $query = mysql_query($sql)。 while($rs=mysql_fetch_array($query)) { $product_sort[]=array( 39。 id39。 = $rs[39。 id39。 ], 39。 name39。 = $rs[39。 name39。 ], 39。 oldprice39。 = $rs[39。 oldprice39。 ], 39。 newprice39。 = $rs[39。 newprice39。 ] )。 } // //显示商品信息 /*判断是否接受值,有表示点击首页或者本页左侧的书的分类 没有则默认显示经济类图书 */ if($_GET[39。 id39。 ]) $id=$_GET[39。 id39。 ]。 else $id=1。 if($id) { $sql2 = select * from `product` where `sort_id`=.$id。 $query2 = mysql_query($sql2)。 $num = mysql_num_rows($query2)。 $a = new Page($_GET[39。 page39。 ])。 $apageft($num,2)。 if($agetfristcount()0){ $asetfristcount(0)。 } $sql = select * from `product` where `sort_id`=39。 .$id.39。 limit .$agetfristcount().,6。 $query = mysql_query($sql)。 while($rs=mysql_fetch_array($query)) { $product[] = array( product_name = $rs[39。 product_name39。 ], product_hao = $rs[39。 product_。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。