diff --git a/application/admin/controllers/NewsController.php b/application/admin/controllers/NewsController.php index b6d666b4..8e77406e 100644 --- a/application/admin/controllers/NewsController.php +++ b/application/admin/controllers/NewsController.php @@ -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; }//栏目列表 diff --git a/application/admin/views/scripts/news/catlog.phtml b/application/admin/views/scripts/news/catlog.phtml index cdec0272..f3275e3e 100644 --- a/application/admin/views/scripts/news/catlog.phtml +++ b/application/admin/views/scripts/news/catlog.phtml @@ -47,21 +47,25 @@ { foreach($this->catlogs as $k=>$v) { - echo ' - - -
- '.$v['title'].' - - - 浏览 - 文档 - 编辑 - 删除 - '; - if(!empty($v['sub'])) + + if($v['fid']==0) { - foreach($v['sub'] as $vv) + echo ' + + +
+ '.$v['title'].' + + + 浏览 + 文档 + 编辑 + 删除 + '; + } + foreach($this->catlogs as $vv) + { + if($vv['fid']==$v['id']) { echo ' @@ -78,6 +82,7 @@ } } } + }else{ echo '暂无数据'; } diff --git a/application/default/controllers/NewsController.php b/application/default/controllers/NewsController.php index 8cf6fb56..656b0533 100644 --- a/application/default/controllers/NewsController.php +++ b/application/default/controllers/NewsController.php @@ -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); + $archives = $rs->fetchAll(); - $rs = $this->db->query($sql); - $rows = $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() diff --git a/application/default/views/scripts/news/index.phtml b/application/default/views/scripts/news/index.phtml index 70ba6a93..eb1ccafb 100644 --- a/application/default/views/scripts/news/index.phtml +++ b/application/default/views/scripts/news/index.phtml @@ -38,38 +38,23 @@ $this->breadcrumb()->setSeparator(' > ');
-
- -
-