From 20f8cd8ad19d4766f3486f4bb9bf3f86ec284c5d Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Wed, 7 Nov 2012 02:35:58 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E5=8F=B0=E6=96=B0?= =?UTF-8?q?=E9=97=BB=E5=88=86=E7=B1=BB=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=96=B0=E9=97=BB=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/NewsController.php | 7 ++- .../admin/views/scripts/news/catlog.phtml | 33 +++++++------ .../default/controllers/NewsController.php | 32 ++++++++----- .../default/views/scripts/news/index.phtml | 47 +++++++------------ htdocs/css/news.css | 14 ++++-- 5 files changed, 70 insertions(+), 63 deletions(-) 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(' > ');
-
-
    - 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').'...(more)'; - }else{ - $description = $v['description']; - } - echo '
  • - ['.$v['typetitle'].''.$v['title'].'
    - TIME : '.date("Y-m-d H:i",strtotime($v['ts_published'])).' -

    '.$description.'

    -
  • '; - } - } - else - { - echo '暂无数据'; - } + lists as $v) + {?> + 0) {?> +
    +
    +
    +
      + +
    • + +
    +
    +
    + -
-
-