php 文件分页代码 上一页 下一页

WBOY
リリース: 2016-06-08 17:29:55
オリジナル
1607 人が閲覧しました

提供一款超好的php 文件分页代码 上一页 下一页哦,这一款是dedecms的生成页面时的分页程序代码。

<script>ec(2);</script>

function GetPagebreakDM($totalPage,$nowPage,$aid)
 {
  global $cfg_rewrite;
  if($totalPage==1)
  {
   return "";
  }
  $PageList = "

  • 共".$totalPage."页:
  • ";
      $nPage = $nowPage-1;
      $lPage = $nowPage+1;
      if($nowPage==1)
      {
       $PageList.="
  • 上一页
  • ";
      }
      else
      {
       if($nPage==1)
       {
        $PageList.="
  • 上一页
  • ";
        if($cfg_rewrite == 'Y')
        {
         $PageList = preg_replace("/.php?aid=(d+)/i",'-\1-1.html',$PageList);
        }
       }
       else
       {
        $PageList.="
  • 上一页
  • ";
        if($cfg_rewrite == 'Y')
        {
         $PageList = str_replace(".php?aid=","-",$PageList);
         $PageList =  preg_replace("/&pageno=(d+)/i",'-\1.html',$PageList);
        }
       }
      }
      for($i=1;$i   {
       if($i==1)
       {
        if($nowPage!=1)
        {
         $PageList.="
  • 1
  • ";
         if($cfg_rewrite == 'Y')
         {
          $PageList = preg_replace("/.php?aid=(d+)/i",'-\1-1.html',$PageList);
         }
        }
        else
        {
         $PageList.="
  • 1
  • ";
        }
       }
       else
       {
        $n = $i;
        if($nowPage!=$i)
        {
         $PageList.="
  • ".$n."
  • ";
         if($cfg_rewrite == 'Y')
         {
          $PageList = str_replace(".php?aid=","-",$PageList);
          $PageList =  preg_replace("/&pageno=(d+)/i",'-\1.html',$PageList);
         }
        }
        else
        {
         $PageList.="
  • {$n}
  • ";
        }
       }
      }
      if($lPage   {
       $PageList.="
  • 下一页
  • ";
       if($cfg_rewrite == 'Y')
       {
        $PageList = str_replace(".php?aid=","-",$PageList);
        $PageList =  preg_replace("/&pageno=(d+)/i",'-\1.html',$PageList);
       }
      }
      else
      {
       $PageList.= "
  • 下一页
  • ";
      }
      return $PageList;
     }
    関連ラベル:
    ソース:php.cn
    このウェブサイトの声明
    この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
    人気のおすすめ
    人気のチュートリアル
    詳細>
    最新のダウンロード
    詳細>
    ウェブエフェクト
    公式サイト
    サイト素材
    フロントエンドテンプレート
    私たちについて 免責事項 Sitemap
    PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!