diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 752f3f61..28a1d412 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -312,7 +312,14 @@ class DataController extends Zend_Controller_Action $this->view->codename=(empty($row->name_zh)?$row->name:$row->name_zh); $sql='select m.* from metadata m,category c where m.id=c.id and c.code=? order by m.title'; $state=$db->query($sql,array($code)); - $this->view->metadata = $state->fetchAll(); + $rows = $state->fetchAll(); + + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; } else { //提供全部分类列表 } diff --git a/application/default/views/scripts/data/category.phtml b/application/default/views/scripts/data/category.phtml index 6fc72b63..b36f458e 100755 --- a/application/default/views/scripts/data/category.phtml +++ b/application/default/views/scripts/data/category.phtml @@ -1,39 +1,51 @@ -headTitle($this->config->title->site); - $this->headTitle($this->config->title->data); -$this->headTitle('分类浏览'); -if (!empty($this->codename)) $this->headTitle($this->codename); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/metadata.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb('分类浏览'); -if (!empty($this->codename)) $this->breadcrumb($this->codename); -$this->breadcrumb()->setSeparator(' > '); -?> -
-partial('data/tools.phtml'); ?> -
- -
-
数据集类别 -
-
-
-metadata)) : ?> -

当前浏览分类:codename; ?>

-metadata as $md) : ?> -
-
-
-

escape($md['title']);?> -

- 400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?> -
- +headTitle($this->config->title->site); + $this->headTitle($this->config->title->data); +$this->headTitle('分类浏览'); +if (!empty($this->codename)) $this->headTitle($this->codename); +$this->headTitle()->setSeparator(' - '); +$this->headLink()->appendStylesheet('/css/metadata.css'); +$this->breadcrumb('首页'); +$this->breadcrumb(''.$this->config->title->data.''); +$this->breadcrumb('分类浏览'); +if (!empty($this->codename)) $this->breadcrumb($this->codename); +$this->breadcrumb()->setSeparator(' > '); +?> +
+partial('data/tools.phtml'); ?> +
+ +
+
数据集类别 +
    +category as $cg) : ?> +
  • '>()
  • + +
+
+
+ +paginator)): ?> +paginator as $item): + $i++; + if (mb_strlen($item['description'])>700) + { + $item['description'] = mb_substr($item['description'],0,400,'UTF-8').'...'; + } + if($i%2==0) $style="style='background:#fafafa;'"; + else $style=""; + echo '
+
+

'.$this->escape($item['title']).' +

+

'.$item['description'].'

+
'; +endforeach; +?> + + +paginator; ?> +
\ No newline at end of file diff --git a/application/default/views/scripts/pagination_param.phtml b/application/default/views/scripts/pagination_param.phtml new file mode 100644 index 00000000..bc11a2c9 --- /dev/null +++ b/application/default/views/scripts/pagination_param.phtml @@ -0,0 +1,26 @@ +pageCount): ?> +
+ +previous)): ?> + ">< Previous + + < Previous + + + +pagesInRange as $page): ?> + current): ?> + "> + + + + + + +next)): ?> + ">Next > + + Next > + +
+ \ No newline at end of file