XBTIT pager drop down menu error solved

  • 1 Replies
  • 149 Views
*

Offline Enoch-X

  • **
  • 1
  • +0/-0
XBTIT pager drop down menu error solved
« on: July 21, 2018, 09:18:57 pm »
Hi everybody, good day!

I would like to share the solution to the pager error where the pagination goes off the canvas!

I've searched the entire Internet for and answer but unfortunately couldn't find it, so I started with the old art of trial and error and I found a (the) solution to the problem!

Step 1 Go to your tracker directory/include/functions.php >> step 2 find the pager function on line 772 and select the code from line 772 'till 845

Code: [Select]
function pager($rpp, $count, $href, $opts = array()) {
  global $language;

  $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 ,((int)$_GET[$opts['pagename']]));
    else
      $page = $pagedefault;
  } elseif (isset($_GET['pages'])) {
    $page = max(1,((int)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;<span class=\"pager\"><a href=\"{$href}$pagename=1\">&nbsp;&laquo;</a></span>";
    $pager .= "\n<span class=\"pager\"><a href=\"{$href}$pagename=".($page-1)."\">&lt;&nbsp;</a></span>";
  }

  if ($count) {
    for ($i = $begin; $i <= $end; $i++) {
      if ($i != $page)
        $pager .= "\n&nbsp;<span class=\"pager\"><a href=\"{$href}$pagename=$i\">$i</a></span>";
      else
        $pager .= "\n&nbsp;<span class=\"pagercurrent\"><b>$i</b></span>";
    }

    if ($page < $mp && $mp >= 1) {
      $pager .= "\n&nbsp;<span class=\"pager\"><a href=\"{$href}$pagename=".($page+1)."\">&nbsp;&gt;</a></span>";
      $pager .= "\n&nbsp;<span class=\"pager\"><a href=\"{$href}$pagename=$pages\">&nbsp;&raquo;</a></span>";
    }

    $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");
}

Repalce this code with the code below...

Code: [Select]
function pager($rpp, $count, $href, $opts = array()) {
  global $language;

  $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 ,((int)$_GET[$opts['pagename']]));
    else
      $page = $pagedefault;
  } elseif (isset($_GET['pages'])) {
    $page = max(1,((int)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"><div align="center">'."\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;<a href=\"{$href}$pagename=1\">&nbsp;&laquo;</a></span>";
    $pager .= "\n<a href=\"{$href}$pagename=".($page-1)."\">&lt;&nbsp;</a></span>";
  }

  if ($count) {
    for ($i = $begin; $i <= $end; $i++) {
      if ($i != $page)
        $pager .= "\n&nbsp;<a href=\"{$href}$pagename=$i\">$i</a></span>";
      else
        $pager .= "\n&nbsp;<span class=\"pagercurrent\"><b>$i</b></span>";
    }

    if ($page < $mp && $mp >= 1) {
      $pager .= "\n&nbsp;<a href=\"{$href}$pagename=".($page+1)."\">&nbsp;&gt;</a></span>";
      $pager .= "\n&nbsp;<a href=\"{$href}$pagename=$pages\">&nbsp;&raquo;</a></span>";
    }

    $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");
}

The error is being caused by the code
Code: [Select]
<span class=\"pager\">!!! All you need to do is remove this code from the pager function and the pager and drop down functions and looks good again!

Succes! ;-)
« Last Edit: July 21, 2018, 09:26:11 pm by Enoch-X »

*

Offline Rogelioy

  • **
  • 2
  • +0/-0
Re: XBTIT pager drop down menu error solved
« Reply #1 on: August 07, 2018, 06:23:38 am »
I would like to know why I can get more information and clear enough to introduce me?

 


Powered by EzPortal