public function actionIndex($typeId) { $this->pageTitle = "新闻分类"; //查询该分类下所有新闻 $newsInfo = NewsArticles::model()->findAll("typeId={$typeId}"); //查询该分类的详细信息 $newsType = NewsTypes::model()->findByPk($typeId); if ($newsInfo == NULL) { $this->redirect(__APP__ . "/success/index/act/nocontent"); } $data = array("newsInfo" => $newsInfo, "newsType" => $newsType); $this->render("index", $data); }
if ($result > 0) { echo "<script type='text/javascript'>"; echo "\talert('发表评论成功!');"; echo "\twindow.location='news.php?articleId={$articleId}';"; echo "</script>"; } else { echo "<script type='text/javascript'>"; echo "\talert('发表评论失败!');"; echo "\twindow.location='news.php?articleId={$articleId}';"; echo "</script>"; } } //获得当前页面显示的新闻 $result3 = NewsArticles::getNewsById($articleId); //所有分类 $newsTypes = NewsTypes::getNewsTypes(); //获得该新闻的所有评论 $reviews = Reviews::getReviews($articleId); ?> <html> <head> <title>天天新闻网</title> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <link href="css/news.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="kindeditor/kindeditor.js"></script> <script type="text/javascript"> var editor;//编辑器对象 KindEditor.ready(function(e){ editor = e.create("[name=content]",{ "width":"560px", "height":"200px",
<?php header("content-type:text/html;charset=utf-8"); include_once '../dbio/NewsArticles.php'; include_once '../dbio/NewsTypes.php'; include_once 'nologin.php'; $articleId = $_GET['articleId']; $deleteNews = NewsArticles::deleteNews($articleId); if ($deleteNews != '') { $typeId = $_GET['typeId']; $delNums = NewsTypes::delNums($typeId); } //print_r(delNums); //获得表单提交的数据 $searchType = $_POST["searchType"]; $keyword = $_POST["keyword"]; $currentPage = $_POST["currentPage"]; //当前页的页码 $currentPage = $currentPage == NULL ? 1 : $currentPage; //搜索新闻 if ($keyword != NULL) { $result = NewsArticles::getNewsInfo($currentPage, $keyword, $searchType); $totalPage = $result[0]; $newsInfo = $result[1]; } else { $result = NewsArticles::getNewsInfo($currentPage); //所有新闻 $totalPage = $result[0]; $newsInfo = $result[1]; } ?>
<?php header("content-type:text/html;charset=utf-8"); include_once 'dbio/NewsTypes.php'; include_once 'dbio/NewsArticles.php'; //获得url中的参数 $typeId = $_GET["typeId"]; $newsTypes = NewsTypes::getNewsTypes(); //所有分类 $newsInfo = NewsArticles::getNewsByTypeId($typeId); //当前分类的所有新闻 $newsType = NewsTypes::getNewsTypeById($typeId); //当前分类的详细信息 ?> <html> <head> <title>天天新闻网</title> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <link href="css/news.css" type="text/css" rel="stylesheet" /> </head> <body> <!-- 网站头 --> <?php include_once 'header.php'; ?> <!-- 正文内容 --> <div class="mainDiv clear"> <div class="newsTypeDiv"> <div class="newsTypeDiv1"> <a href="index.php" class="a">新闻主页</a> » <?php echo $newsType["typeName"];
<?php header("content-type:text/html;charset=utf-8"); include_once 'smarty/Smarty.class.php'; include_once 'dbio/NewsTypes.php'; include_once 'dbio/NewsArticles.php'; $smarty = new Smarty(); //获得url中的typeId $typeId = $_GET["typeId"]; $newsTypes = NewsTypes::getNewsTypes(); //所有分类 $newsInfo = NewsArticles::getNewsInfoByTypeId($typeId); //当前分类下所有新闻 $newsType = NewsTypes::getNewsType($typeId); //该分类的详细信息 $smarty->assign("newsType", $newsType); $smarty->assign("newsInfo", $newsInfo); $smarty->assign("newsTypes", $newsTypes); $smarty->display("newstype.html"); ?>
public function init() { //查询所有分类(导航菜单用) $this->newsTypes = NewsTypes::model()->findAll(); }
<?php header("content-type:text/html;charset=utf-8"); include_once 'nologin.php'; include_once '../dbio/NewsTypes.php'; $typeName = $_POST["typeName"]; //表单提交(添加分类) if ($typeName != NULL) { $result = NewsTypes::addType($typeName); header("location:success.php?act=addtype&rst={$result}"); } ?> <html> <head> <title>添加分类</title> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <link href="../css/admin.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="../jquery/jquery-1.4.js"></script> <script type="text/javascript"> function checkAdd() { if(document.frm.typeName.value == "") { alert("请输入分类名称!"); document.frm.typeName.focus(); return false; } } </script> </head> <body>