当前位置: 首页>>代码示例>>PHP>>正文


PHP Pager::_buildQueryString方法代码示例

本文整理汇总了PHP中Pager::_buildQueryString方法的典型用法代码示例。如果您正苦于以下问题:PHP Pager::_buildQueryString方法的具体用法?PHP Pager::_buildQueryString怎么用?PHP Pager::_buildQueryString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pager的用法示例。


在下文中一共展示了Pager::_buildQueryString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLinks

 /**
  * Returns an array with the paginated links, one in each item.
  *
  * @access  public
  * @param   int $row Current page number (starts from zero)
  * @param   int $total_rows Total number of rows, as returned by Pager::getTotalRows()
  * @param   int $per_page Maximum number of rows per page
  * @param   string $show_links An option to show 'Next'/'Previous' links, page numbering links or both ('sides', 'pages' or 'all')
  * @param   string $show_blank An option to show 'Next'/'Previous' strings even if there are no appropriate next or previous pages
  * @param   array $link_str The strings to be used instead of the default 'Next >>' and '<< Previous'
  * @return  array The list of paginated links
  * @see     getTotalRows()
  */
 function getLinks($row, $total_rows, $per_page, $show_links = "all", $show_blank = "off", $link_str = -1)
 {
     global $HTTP_SERVER_VARS;
     // check for emptyness
     if (empty($total_rows) || empty($per_page)) {
         return array();
     }
     if ($link_str == -1) {
         if (APP_CURRENT_LANG == "br") {
             $link_str = array("previous" => "&lt;&lt; Anterior", "next" => "Próxima &gt;&gt;");
         } else {
             $link_str = array("previous" => "&lt;&lt; Previous", "next" => "Next &gt;&gt;");
         }
     }
     $extra_vars = Pager::_buildQueryString();
     $file = $HTTP_SERVER_VARS["SCRIPT_NAME"];
     $number_of_pages = ceil($total_rows / $per_page);
     $subscript = 0;
     for ($current = 0; $current < $number_of_pages; $current++) {
         // if we need to show all links, or the 'side' links,
         // let's add the 'Previous' link as the first item of the array
         if (($show_links == "all" || $show_links == "sides") && $current == 0) {
             if ($row != 0) {
                 $array[0] = '<A HREF="' . $file . '?pagerRow=' . ($row - 1) . $extra_vars . '">' . $link_str["previous"] . '</A>';
             } elseif ($row == 0 && $show_blank == "on") {
                 $array[0] = $link_str["previous"];
             }
         }
         // check to show page numbering links or not
         if ($show_links == "all" || $show_links == "pages") {
             if ($row == $current) {
                 // if we only have one page worth of rows, we should show the '1' page number
                 if ($current == $number_of_pages - 1 && $number_of_pages == 1 && $show_blank == "off") {
                     $array[0] = "<b>" . ($current > 0 ? $current + 1 : 1) . "</b>";
                 } else {
                     $array[++$subscript] = "<b>" . ($current > 0 ? $current + 1 : 1) . "</b>";
                 }
             } else {
                 $array[++$subscript] = '<A HREF="' . $file . '?pagerRow=' . $current . $extra_vars . '">' . ($current + 1) . '</A>';
             }
         }
         // only add the 'Next' link to the array if we are on the last iteration of this loop
         if (($show_links == "all" || $show_links == "sides") && $current == $number_of_pages - 1) {
             if ($row != $number_of_pages - 1) {
                 $array[++$subscript] = '<A HREF="' . $file . '?pagerRow=' . ($row + 1) . $extra_vars . '">' . $link_str["next"] . '</A>';
             } elseif ($row == $number_of_pages - 1 && $show_blank == "on") {
                 $array[++$subscript] = $link_str["next"];
             }
         }
     }
     return $array;
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:65,代码来源:class.pager.php


注:本文中的Pager::_buildQueryString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。