/** * @param <type> $id * @return NewRSS */ public function get($id) { return $this->dao->get($id); }
<?php //引入静态常量 require_once '../../../util/StackConst.php'; //引入新闻操作DAO require_once '../dao/NewsDao.php'; //获得传递过来的新闻ID $news_id = @$_GET['news_id']; //实例化新闻DAO $newsDao = new NewsDao(); //获取新闻列表 $arrNewsDetail = $newsDao->getNewsById($news_id); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script language="javascript" type="text/javascript" src="../../zjs/jquery-1.8.3.js"></script> <title>修改新闻信息</title> <script type="text/javascript"> function hhfwz(){ var descrip = $("#news_content").val(); descrip=descrip.replace(/\r\n|\n/g,'<br/>'); $("#news_content").val(descrip); } </script> </head> <body> <form action="../control/newscontrol.php" method="post">
<?php //引入静态常量 require_once '../../../util/StackConst.php'; //引入新闻操作DAO require_once '../dao/NewsDao.php'; //实例化新闻DAO $newsDao = new NewsDao(); //获取新闻列表 $arrNews = $newsDao->getNewsList(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>新闻中心列表</title> </head> <body> <table border="1" width="100%"> <tr> <th width="5%">序号</th> <th width="25%">标题</th> <th>内容</th> <th width="10%" colspan="2">操作</th> </tr> <?php $XH = 1; foreach ($arrNews as $news) { ?> <tr>
echo "添加新闻信息失败!"; } } else { if ("deleteNews" == $type) { //引入NewsDao require_once '../dao/NewsDao.php'; //实例化dao $news = new NewsDao(); if ($news->deleteNewsById(@$_GET['news_id'])) { echo "删除新闻信息成功!"; StackConst::jump_page("../view/newslist.php"); } else { echo "删除新闻信息失败!"; } } else { if ("updateNews" == $type) { //修改新闻 //引入NewsDao require_once '../dao/NewsDao.php'; //实例化dao $newsDao = new NewsDao(); $arrNewsInfo = array("news_id" => @$_POST['news_id'], "news_title" => @$_POST['news_title'], "news_content" => @$_POST['news_content'], "news_createdate" => StackConst::get_date_sort()); if ($newsDao->updateNewsById($arrNewsInfo)) { echo "修改新闻信息成功!"; StackConst::jump_page("../view/newslist.php"); } else { echo "修改新闻信息失败!"; } } } }