| 
 | 
 
找到 
modules\article\class\package.php 
 
 
目录分页 
 
  1、找到以下代码段 
-      foreach($this->chapters as $k => $chapter){
 
 
  
  2、替换为 
-  
 -  
 -      //处理上一页和下一页页码
 -  
 - $pageid = intval($_GET['page']);
 -  
 - $aid = intval($_GET['aid']);
 -  
 - $pagenum = 50;
 -  
 - $pagecount =ceil( count($this->chapters)/$pagenum );
 -  
 - if($pageid != 1){
 -  
 - $previd = $pageid - 1;
 -  
 - }
 -  
 - if($pageid != $pagecount){
 -  
 - $nextcid = $pageid + 1;
 -  
 - }
 -  
 - else{
 -  
 - $nextcid = $pagecount;
 -  
 - }
 -  
 - //页码设置//
 -  
 - $shouye = '<a href="reader.php?aid='.$aid.'">首页 </a>';
 -  
 - $prepage = '<a href="reader.php?aid='.$aid.'&page='.$previd.'"> 上一页 </a>';
 -  
 - $nextpage = '<a href="reader.php?aid='.$aid.'&page='.$nextcid.'"> 下一页 </a>';
 -  
 - $weiye = '<a href="reader.php?aid='.$aid.'&page='.$pagecount.'"> 尾页</a>';
 -  
 - //首页尾页处理
 -  
 - //第一页
 -  
 - if($pageid == 1 ){ $shouye = '';$prepage = ''; }
 -  
 - //最后一页
 -  
 - if($pageid == $pagecount){ $weiye = '';$nextpage = ''; }
 -  
 - if($pageid == 1 && $pageid == $pagecount){
 -  
 - $nextpage = '<a href="reader.php?aid='.$aid.'&page='.$nextcid.'">下一页 </a>';
 -  
 - $weiye = '<a href="reader.php?aid='.$aid.'&page='.$pagecount.'"> 尾页</a>';
 -  
 - }
 -  
 -  
 -  
 -  
 - $pagelink = '
 -  
 - <div class="page">'.$shouye.$prepage.$nextpage.$weiye.'</div>
 -  
 - <div class="page">输入页数<input id="pageinput" size="4" /><input type="button" value="跳转" /> <br/>(第'.$pageid.'/'.$pagecount.'页)当前'.$pagenum.'条/页</div>
 -  
 - <script>
 -  
 - function page(){
 -  
 - var p = document.getElementById("pageinput").value;
 -  
 - if(isPositiveNum(p)){window.open("reader.php?aid='.$aid.'&page="+p+"/","_self");}
 -  
 - function isPositiveNum(s){ 
 -  
 - var re = /^[0-9]*[1-9][0-9]*$/ ;  
 -  
 - return re.test(s)  
 -  
 - }
 -  
 - }
 -  
 - </script>
 -  
 - ';
 -  
 - $jieqiTpl->assign('pagelink',$pagelink);
 -  
 - //处理上一页和下一页页码结束
 -  
 -  
 -  
 -  
 - $kkk = array_slice($this->chapters,($pageid-1)*$pagenum,$pagenum);//分页设置array_slice
 -  
 - foreach($kkk as $k => $chapter){   //$this->chapters  改成 $kkk
 
 
  
3、只需在模板文件适当的位置 使用标签 {?$pagelink?}即可 
 
 
 
杰奇阅读页分页代码使用说明 
 
第一步,打开/modules/article/class/package.php查找jieqi_content,在该语句上面一行加上以下代码:(若调用的不是pacheage.php而是其他文件,请修改对应的文件) 
 
- $page = intval($_GET['page']);
 -  
 - if ($page<1) $page=1;
 -  
 - if($page){
 -  
 - $length=strlen($tmpvar);
 -  
 - $zishu=ceil($length/4)+10;
 -  
 - if ($length<8000) $zishu=ceil($length/3)+10;
 -  
 - if ($length<4000) $zishu=ceil($length/2)+10;
 -  
 - if ($length<2000) $zishu=$length+10;
 -  
 - $page_count=ceil($length/$zishu);
 -  
 - function msubstr($str,$start,$len){
 -  
 - $strlength=$start+$len;
 -  
 - $tmpstr="";
 -  
 - for($i=0;$i<$strlength;$i++) {
 -  
 - if(ord(substr($str,$i,1))>0xa0) {
 -  
 - $tmpstr.=substr($str,$i,2);
 -  
 - $i++;
 -  
 - }else{
 -  
 - $tmpstr.=substr($str,$i,1);
 -  
 - }
 -  
 - }
 -  
 - return $tmpstr;
 -  
 - }
 -  
 - //------------截取中文字符串---------
 -  
 - $c=msubstr($tmpvar,0,($page-1)*$zishu);
 -  
 - $c1=msubstr($tmpvar,0,$page*$zishu);
 -  
 - $tmpvar=substr($c1,strlen($c),strlen($c1)-strlen($c));
 -  
 - }
 -  
 - $jieqiTpl->assign('prev',$page-1);
 -  
 - $next=0;
 -  
 - if ($page<$page_count) $next=$page+1;
 -  
 - $jieqiTpl->assign('next',$next);
 -  
 - $jieqiTpl->assign('page',$page);
 -  
 - $jieqiTpl->assign('page_count',$page_count);
 -  
 - $jieqiTpl->assign('jieqi_content',$tmpvar);
 
 
  
 
第二步:打开阅读页模板文件: 
 
在TITLE标签里的章节名后面加上:{?if $page != 1?}-第{?$page?}页{?/if?} 
在章节名{?$jieqi_title?}后加上:{?if $page != 1?}(第{?$page?}/{?$page_count?}页){?/if?} 
以上两个不需要的可以不加 
 
在{?$jieqi_content?}后面加上–>>这几个字符,以免在截取到<br>中间的时候造成错位 
 
将上一页连接改成:{?if $prev==0?}{?if $preview_chapterid==”?}/wcxs/{?$article_id?}/{?else?}{?$preview_chapterid?}.html{?/if?}{?else?}/wcxs/{?$article_id?}/{?$chapter_id?}{?if $prev!=1?}_{?$prev?}{?/if?}.html{?/if?} 
将下一页连接改成:{?if $next==0?}{?if $next_chapterid==”?}/wcxs/{?$article_id?}/{?else?}{?$next_chapterid?}.html{?/if?}{?else?}/wcxs/{?$article_id?}/{?$chapter_id?}_{?$next?}.html{?/if?} 
 
上下页连接如需改成伪静态请按需修改 
 
 |   
 
 
 
 |