本帖最后由 网络科技 于 2016-8-9 17:58 编辑
如图
我想把这个分页修改成下面图片中的样子 还望大神帮忙一下
- <?php
- if(!defined('IN_DISCUZ')) {exit('Access Denied');}
- $perpage = 3; //每页显示数
- $forumids = array(2,45); //指定调用的版块ID,如果调用全部,请用array(),如$forumids = array();
- $orderby = 'dateline desc'; //排序方式
- $threadlist = $post = array();
- if ($forumids){
- $filterarr = array('inforum' => $forumids, 'sticky' => 0, 'displayorder' => array(0, 1, 2, 3, 4));
- $count = C::t('forum_thread')->count_search($filterarr, 0);
- $page = intval($_G['page']) ? intval($_G['page']) : 1;
- $start = ($page-1)*$perpage;
- if($start<0) $start = 0;
- if ($count){
- require_once libfile('function/post');
- foreach(C::t('forum_thread')->fetch_all_search($filterarr, 0, $start, $perpage, $orderby, '') as $thread) {
- $thread['post'] = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
- $attachment = C::t('forum_attachment_n')->fetch_max_image(getattachtableid($tid), 'pid', $thread['post']['pid']);
- $thread['aid'] = $attachment['aid'];
- $threadlist[] = $thread;
- }
- $allpages = @ceil($count / $perpage);
- if ($page > 1){$lastpage = $page-1;}
- if ($page < $allpages){$nextpage = $page+1;}
- }
- }
- ?>
复制代码
这是原本的代码
这是 模版文件分页处代码
- <div style="margin-top:20px;" class="wp1024 mbw cl">
- <p class="{if $lastpage && $nextpage}fd_page2{else}fd_page1{/if}">
- <!--{if $lastpage}--><a class="fd_last" href="forum.php?page=$lastpage"></a><!--{/if}-->
- <!--{if $nextpage}--><a class="fd_next" href="forum.php?page=$nextpage"></a><!--{/if}-->
- </p>
- </div>
复制代码
经过几天折磨 最终还是没有琢磨出来
|