歡迎光臨, 訪客. 請先 登入註冊一個帳號.
四月 25, 2024, 05:08:26 上午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
LifeType 中文開發論壇  |  開發  |  核心補強  |  改善分页显示的格式 « 上篇主題 下篇主題 »
頁: [1]
作者 主題: 改善分页显示的格式  (閱讀 7066 次)
maomaode
一般會員
***
文章: 115


檢視個人資料
« 於: 十一月 19, 2006, 06:39:25 下午 »

1.1 已经加入分页显示, 不过我个人感觉还可以进一步完善,  在1.0时候, bokeland.com 就已经加入了分页, 大家可以察看http://bokeland.bokeland.com 看到效果, 主要的思路是分页不不宜显示太长, 最多显示10个, 同时加上首页和末页.

要达到这个效果, 只需要修改下面这个片段 class/data/pager/pager.class.php:
引用
      function getPageLinks()
      {
          $min_num = 5;

          if ($this->_totalPages <= $min_num) {
            return $this->_pageLinks;
         }

          $start_id = 1;
          $end_id = $this->_totalPages;
 
          if ($this->_curPage >= $min_num) {
            $start_id = $this->_curPage - $min_num + 1;
            $end_id = $this->_curPage + $min_num;
            if ($end_id > $this->_totalPages) {
                  $end_id = $this->_totalPages;
             }
          } else {
            $start_id = 1;
            $end_id = $this->_curPage + $min_num - 1;
            if ($end_id > $this->_totalPages) {
              $end_id = $this->_totalPages;
            }
          }
   
          $decent_pages = array();
          for ($i = $start_id; $i <= $end_id; $i++) {
            $decent_pages[$i] = $this->_pageLinks[$i];
          }
          return $decent_pages;
      }
Hi mark,
不知道是否可以考虑加入到core里面

谢谢!
已記錄

我的blog:
               http://maomaode.bokeland.com
Blog搬家/同步
               http://banjia.bokeland.com
頁: [1]
LifeType 中文開發論壇  |  開發  |  核心補強  |  改善分页显示的格式 « 上篇主題 下篇主題 »
    前往: