Bootstrap分页问题

时间:2016-07-16 14:27:25

标签: php twitter-bootstrap

我有我的网站,我转换为bootstrap,一切都很好,但寻呼机。我的网站现在在functions.php中使用的系统

 function pager($rpp, $count, $href, $opts = array())
{
   global $language, $btit_settings;
   $pager_type = "new";
   if($btit_settings["fmhack_pager_type_select"] == "enabled")
      $pager_type = $btit_settings["pager_type"];
   if($pager_type == "new")
   {
      $pages = ($rpp == 0)?1:ceil($count / $rpp);
      if(!isset($opts['lastpagedefault']))
         $pagedefault = 1;
      else
      {
         $pagedefault = floor(($count - 1) / $rpp);
         if($pagedefault < 1)
            $pagedefault = 1;
      }
      $pagename = 'pages';
      if(isset($opts['pagename']))
      {
         $pagename = $opts['pagename'];
         if(isset($_GET[$opts['pagename']]))
            $page = max(1, intval($_GET[$opts['pagename']]));
         else
            $page = $pagedefault;
      }
      elseif(isset($_GET['pages']))
      {
         $page = max(1, intval(0 + $_GET['pages']));
         if($page < 0)
            $page = $pagedefault;
      }
      else
         $page = $pagedefault;
      $pager = '';
      if($pages > 1)
      {
         $pager .= "\n".'<form name="change_page'.$pagename.'" method="post" action="index.php">'."\n".'<select class="drop_pager" name="pages" onchange="location=document.change_page'.$pagename.
         '.pages.options[document.change_page'.$pagename.'.pages.selectedIndex].value" size="1">';
         for($i = 1; $i <= $pages; $i++)
            $pager .= "\n<option ".($i == $page?'selected="selected"':'')."value=\"$href$pagename=$i\">$i</option>";
         $pager .= "\n</select>";
      }
   $mp = $pages; // - 1;
   $begin = ($page > 3?($page < $pages - 2?$page - 2:$pages - 2):1);
   $end = ($pages > $begin + 2?($begin + 2 < $pages?$begin + 2:$pages):$pages);
   if($page > 1)
   {
      $pager .= "\n&nbsp;<ul class=\"pagination\"><li><a href=\"{$href}$pagename=1\">&nbsp;&laquo;</a></li>></ul>";
      $pager .= "\n<ul class=\"pagination\"><li><a href=\"{$href}$pagename=".($page - 1)."\">&lt;&nbsp;</a></li></ul>";
   }
   if($count)
   {
      for($i = $begin; $i <= $end; $i++)
      {
         if($i != $page)
            $pager .= "\n&nbsp;<ul class=\"pagination\"><li><a href=\"{$href}$pagename=$i\">$i</a></li></ul>";
         else
            $pager .= "\n&nbsp;<li class=\"active\">$i</li>";
      }
      if($page < $mp && $mp >= 1)
      {
         $pager .= "\n&nbsp;<ul class=\"pagination\"><li><a href=\"{$href}$pagename=".($page + 1)."\">&nbsp;&gt;</a></li></ul>";
         $pager .= "\n&nbsp;<ul class=\"pagination\"><li><a href=\"{$href}$pagename=$pages\">&nbsp;&raquo;</a></li></ul>";
      }
      $pagertop = "$pager\n</form>";
      $pagerbottom = str_replace("change_page", "change_page1", $pagertop)."\n";
   }
   else
   {
      $pagertop = "$pager\n</form>";
      $pagerbottom = str_replace("change_page", "change_page1", $pagertop)."\n";
   }
   $start = ($page - 1) * $rpp;
   if($pages < 2)
   {
      // only 1 page??? don't need pager ;)
      $pagertop = '';
      $pagerbottom = '';
   }
   return array(
      $pagertop,
      $pagerbottom,
      "LIMIT $start,$rpp");
}

我可以使用简单的方法或插件来合并bootstraps吗?

以下是来自页面requests.php

的示例
list($pagertop,$pagerbottom,$limit) = pager(intval($btit_settings['req_page']),$count,$dir);

然后将其设置为标签

$requeststpl->set("bottom_pager",$pagerbottom);
$requeststpl->set("top_pager",$pagertop);

然后用作标签通过requests.tpl

显示它
<tag:bottom_pager />
<tag:top_pager />

我只是想拥有它所以它看起来像bootstrap风格.....但是这样出来....

SAMPLE SAMPLE2

0 个答案:

没有答案