修改后台新闻分类显示逻辑,修改新闻中心首页
This commit is contained in:
parent
4b3eff44a7
commit
20f8cd8ad1
|
@ -177,7 +177,10 @@ class Admin_NewsController extends Zend_Controller_Action
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
include_once("news.php");
|
||||||
|
$news = new news($this->db);
|
||||||
|
$catlogs = $news->getAllCategory(-1);
|
||||||
|
/*
|
||||||
$sql="select * from news_category WHERE fid=0 order by displayorder asc";
|
$sql="select * from news_category WHERE fid=0 order by displayorder asc";
|
||||||
$re=$this->db->query($sql);
|
$re=$this->db->query($sql);
|
||||||
$catlogs=$re->fetchAll();
|
$catlogs=$re->fetchAll();
|
||||||
|
@ -186,7 +189,7 @@ class Admin_NewsController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$catlogs[$k]['sub'] = $this->getSubCategory($v['id']);
|
$catlogs[$k]['sub'] = $this->getSubCategory($v['id']);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
$this->view->catlogs=$catlogs;
|
$this->view->catlogs=$catlogs;
|
||||||
|
|
||||||
}//栏目列表
|
}//栏目列表
|
||||||
|
|
|
@ -47,21 +47,25 @@
|
||||||
{
|
{
|
||||||
foreach($this->catlogs as $k=>$v)
|
foreach($this->catlogs as $k=>$v)
|
||||||
{
|
{
|
||||||
echo '
|
|
||||||
<tr>
|
if($v['fid']==0)
|
||||||
<td>
|
|
||||||
<div id="paddiv'.$v['id'].'">
|
|
||||||
<a id="titlebtn'.$v['id'].'" class="title"><b>'.$v['title'].'</b></a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="/news/'.$v['url'].'" target="_blank">浏览</a>
|
|
||||||
<a href="/admin/news/newslist/type/'.$v['id'].'">文档</a>
|
|
||||||
<a href="/admin/news/catlog/edit/'.$v['id'].'"><b>编辑</b></a>
|
|
||||||
<a href="/admin/news/catlog/delete/'.$v['id'].'" onclick="return confirm(\'是否确定删除该栏目\')">删除</a></td>
|
|
||||||
</tr>';
|
|
||||||
if(!empty($v['sub']))
|
|
||||||
{
|
{
|
||||||
foreach($v['sub'] as $vv)
|
echo '
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div id="paddiv'.$v['id'].'">
|
||||||
|
<a id="titlebtn'.$v['id'].'" class="title"><b>'.$v['title'].'</b></a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="/news/'.$v['url'].'" target="_blank">浏览</a>
|
||||||
|
<a href="/admin/news/newslist/type/'.$v['id'].'">文档</a>
|
||||||
|
<a href="/admin/news/catlog/edit/'.$v['id'].'"><b>编辑</b></a>
|
||||||
|
<a href="/admin/news/catlog/delete/'.$v['id'].'" onclick="return confirm(\'是否确定删除该栏目\')">删除</a></td>
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
foreach($this->catlogs as $vv)
|
||||||
|
{
|
||||||
|
if($vv['fid']==$v['id'])
|
||||||
{
|
{
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -78,6 +82,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
echo '<tr><td>暂无数据</td><td></td></tr>';
|
echo '<tr><td>暂无数据</td><td></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,21 +19,29 @@ class NewsController extends Zend_Controller_Action
|
||||||
$this->view->types=$types;
|
$this->view->types=$types;
|
||||||
|
|
||||||
$time = date("Y-m-d H:i:s",time());
|
$time = date("Y-m-d H:i:s",time());
|
||||||
$sql = "SELECT arc.*,t.title as typetitle,t.url FROM news_archives arc
|
|
||||||
|
$sql = "SELECT id,title,url FROM news_category WHERE fid=0";
|
||||||
|
$sth = $this->db->query($sql);
|
||||||
|
$rows = $sth->fetchAll();
|
||||||
|
|
||||||
|
$newslist = array();
|
||||||
|
|
||||||
|
foreach($rows as $v)
|
||||||
|
{
|
||||||
|
$sql = "SELECT arc.*,t.title as typetitle,t.url FROM news_archives arc
|
||||||
LEFT JOIN news_category t ON arc.typeid=t.id
|
LEFT JOIN news_category t ON arc.typeid=t.id
|
||||||
WHERE arc.ts_published<'$time' ORDER BY ts_published DESC";
|
WHERE arc.ts_published<'$time' AND arc.typeid={$v['id']}
|
||||||
|
ORDER BY ts_published DESC
|
||||||
|
LIMIT 10";
|
||||||
|
|
||||||
|
$rs = $this->db->query($sql);
|
||||||
|
$archives = $rs->fetchAll();
|
||||||
|
|
||||||
$rs = $this->db->query($sql);
|
$newslist[$v['id']] = array("title"=>$v['title'],"url"=>$v['url'],"id"=>$v['id'],"list"=>$archives);
|
||||||
$rows = $rs->fetchAll();
|
}
|
||||||
|
$this->view->lists = $newslist;
|
||||||
|
|
||||||
$page = $this->_request->getParam('page');
|
|
||||||
|
|
||||||
$paginator = Zend_Paginator::factory($rows);
|
|
||||||
$paginator->setCurrentPageNumber($page);
|
|
||||||
$paginator->setItemCountPerPage($this->view->config->page->max);
|
|
||||||
$paginator->setView($this->view);
|
|
||||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
|
||||||
$this->view->paginator=$paginator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function listAction()
|
function listAction()
|
||||||
|
|
|
@ -38,38 +38,23 @@ $this->breadcrumb()->setSeparator(' > ');
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="Rfloat clear" id="archives_list">
|
<div class="Rfloat clear" id="archives_list">
|
||||||
<div class="archives_list">
|
<?php
|
||||||
<ul>
|
foreach($this->lists as $v)
|
||||||
<?php
|
{?>
|
||||||
if(count($this->paginator))
|
<?php if(count($v['list'])>0) {?>
|
||||||
{
|
<div class="list-archives">
|
||||||
foreach ($this->paginator as $v)
|
<div class="list-title"><a href="/news/<?= $v['url'] ?>"><?= $v['title'] ?></a></div>
|
||||||
{
|
<div class="list-content">
|
||||||
$description = "";
|
<ul>
|
||||||
if(empty($v['description']))
|
<?php foreach($v['list'] as $arc)
|
||||||
{
|
{?>
|
||||||
$description = "No description";
|
<li><a href="/news/<?= $arc['url']?>/archive-<?= $arc['id']?>.html"><?= $arc['title'] ?></a></li>
|
||||||
}else if (mb_strlen($v['description'])>160)
|
<?php }?>
|
||||||
{
|
</ul>
|
||||||
$description = mb_substr($v['description'],0,160,'utf-8').'...<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="more">(more)</a>';
|
</div>
|
||||||
}else{
|
</div>
|
||||||
$description = $v['description'];
|
<?php } }
|
||||||
}
|
|
||||||
echo '<li>
|
|
||||||
[<a href="/news/'.$v['url'].'/" class="type">'.$v['typetitle'].'</a>] <a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="title">'.$v['title'].'</a><br />
|
|
||||||
<small>TIME : '.date("Y-m-d H:i",strtotime($v['ts_published'])).'</small>
|
|
||||||
<p>'.$description.'</p>
|
|
||||||
</li>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo '暂无数据';
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
.mt14{margin-top:14px;}
|
.mt14{margin-top:14px;}
|
||||||
|
|
||||||
.tbox{}
|
.tbox{}
|
||||||
.tbox div.title{width:100%;overflow:hidden;background:#2C6978;color:#FFF;font-size:16px;height:30px;line-height:30px;text-indent:7px;}
|
.tbox div.title{width:100%;overflow:hidden;background:#bb5500;color:#FFF;font-size:16px;height:30px;line-height:30px;text-indent:7px;}
|
||||||
.tbox .title a{color:#FFF;}
|
.tbox .title a{color:#FFF;}
|
||||||
.tbox .title a:hover{text-decoration:underline;}
|
.tbox .title a:hover{text-decoration:underline;}
|
||||||
.tbox .content{width:94%;padding:3%;background:rgb(240,246,248);overflow:hidden;}
|
.tbox .content{width:94%;padding:3%;background:#ffeedd;overflow:hidden;}
|
||||||
.tbox .content a{color:#2C6978;}
|
.tbox .content a{color:#884400;}
|
||||||
|
|
||||||
.tbox .navmenu ul li{border-bottom:1px dashed #ccc;line-height:24px;}
|
.tbox .navmenu ul li{border-bottom:1px dashed #ccc;line-height:24px;}
|
||||||
.tbox .navmenu ul li a{font-size:14px;font-weight:bold;}
|
.tbox .navmenu ul li a{font-size:14px;font-weight:bold;}
|
||||||
|
@ -33,4 +33,10 @@
|
||||||
|
|
||||||
.archive_body div.title{text-align:center;font-size:24px;font-weight:bold;color:#2C6978;padding:10px 0;}
|
.archive_body div.title{text-align:center;font-size:24px;font-weight:bold;color:#2C6978;padding:10px 0;}
|
||||||
.archive_body div.info{text-align:center;padding:10px 0;}
|
.archive_body div.info{text-align:center;padding:10px 0;}
|
||||||
.archive_body div.content{word-break:break-all;word-wrap:break-word;overflow:hidden;}
|
.archive_body div.content{word-break:break-all;word-wrap:break-word;overflow:hidden;}
|
||||||
|
|
||||||
|
.list-archives{width:300px;overflow:hidden;}
|
||||||
|
.list-archives .list-title{width:100%;overflow:hidden;background:#F60;text-indent:12px;}
|
||||||
|
.list-archives .list-title a {color:#FFF;line-height:30px;font-size:14px;}
|
||||||
|
.list-archives .list-content{border:1px solid #F60;}
|
||||||
|
.list-archives .list-content ul li{line-height:20px;text-indent:12px;}
|
Loading…
Reference in New Issue