修改后台新闻分类显示逻辑,修改新闻中心首页
This commit is contained in:
parent
4b3eff44a7
commit
20f8cd8ad1
|
@ -177,7 +177,10 @@ class Admin_NewsController extends Zend_Controller_Action
|
|||
|
||||
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";
|
||||
$re=$this->db->query($sql);
|
||||
$catlogs=$re->fetchAll();
|
||||
|
@ -186,7 +189,7 @@ class Admin_NewsController extends Zend_Controller_Action
|
|||
{
|
||||
$catlogs[$k]['sub'] = $this->getSubCategory($v['id']);
|
||||
}
|
||||
|
||||
*/
|
||||
$this->view->catlogs=$catlogs;
|
||||
|
||||
}//栏目列表
|
||||
|
|
|
@ -47,21 +47,25 @@
|
|||
{
|
||||
foreach($this->catlogs as $k=>$v)
|
||||
{
|
||||
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>';
|
||||
if(!empty($v['sub']))
|
||||
|
||||
if($v['fid']==0)
|
||||
{
|
||||
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 '
|
||||
<tr>
|
||||
|
@ -78,6 +82,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
echo '<tr><td>暂无数据</td><td></td></tr>';
|
||||
}
|
||||
|
|
|
@ -19,21 +19,29 @@ class NewsController extends Zend_Controller_Action
|
|||
$this->view->types=$types;
|
||||
|
||||
$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
|
||||
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);
|
||||
$rows = $rs->fetchAll();
|
||||
$rs = $this->db->query($sql);
|
||||
$archives = $rs->fetchAll();
|
||||
|
||||
$newslist[$v['id']] = array("title"=>$v['title'],"url"=>$v['url'],"id"=>$v['id'],"list"=>$archives);
|
||||
}
|
||||
$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()
|
||||
|
|
|
@ -38,38 +38,23 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
</div>
|
||||
</div>
|
||||
<div class="Rfloat clear" id="archives_list">
|
||||
<div class="archives_list">
|
||||
<ul>
|
||||
<?php
|
||||
if(count($this->paginator))
|
||||
{
|
||||
foreach ($this->paginator as $v)
|
||||
{
|
||||
$description = "";
|
||||
if(empty($v['description']))
|
||||
{
|
||||
$description = "No description";
|
||||
}else if (mb_strlen($v['description'])>160)
|
||||
{
|
||||
$description = mb_substr($v['description'],0,160,'utf-8').'...<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="more">(more)</a>';
|
||||
}else{
|
||||
$description = $v['description'];
|
||||
}
|
||||
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 '暂无数据';
|
||||
}
|
||||
<?php
|
||||
foreach($this->lists as $v)
|
||||
{?>
|
||||
<?php if(count($v['list'])>0) {?>
|
||||
<div class="list-archives">
|
||||
<div class="list-title"><a href="/news/<?= $v['url'] ?>"><?= $v['title'] ?></a></div>
|
||||
<div class="list-content">
|
||||
<ul>
|
||||
<?php foreach($v['list'] as $arc)
|
||||
{?>
|
||||
<li><a href="/news/<?= $arc['url']?>/archive-<?= $arc['id']?>.html"><?= $arc['title'] ?></a></li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php } }
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
.mt14{margin-top:14px;}
|
||||
|
||||
.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:hover{text-decoration:underline;}
|
||||
.tbox .content{width:94%;padding:3%;background:rgb(240,246,248);overflow:hidden;}
|
||||
.tbox .content a{color:#2C6978;}
|
||||
.tbox .content{width:94%;padding:3%;background:#ffeedd;overflow:hidden;}
|
||||
.tbox .content a{color:#884400;}
|
||||
|
||||
.tbox .navmenu ul li{border-bottom:1px dashed #ccc;line-height:24px;}
|
||||
.tbox .navmenu ul li a{font-size:14px;font-weight:bold;}
|
||||
|
@ -34,3 +34,9 @@
|
|||
.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.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