// Pages
if ($lastpage < 7 + ($stages * 2)) // Not enough pages to breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a class='button' href='$targetpage?page=$counter'>$counter</a>";}
}
}
elseif($lastpage > 5 + ($stages * 2)) // Enough pages to hide a few?
{
// Beginning only hide later pages
if($page < 1 + ($stages * 2))
{
for ($counter = 1; $counter < 4 + ($stages * 2); $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a class='button' href='$targetpage?page=$counter'>$counter</a>";}
}
$paginate.= "...";
$paginate.= "<a class='button' href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
$paginate.= "<a class='button' href='$targetpage?page=$lastpage'>$lastpage</a>";
}
// Middle hide some front and some back
elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2))
{
$paginate.= "<a class='button' href='$targetpage?page=1'>1</a>";
$paginate.= "<a class='button' href='$targetpage?page=2'>2</a>";
$paginate.= "...";
for ($counter = $page - $stages; $counter <= $page + $stages; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a class='button' href='$targetpage?page=$counter'>$counter</a>";}
}
$paginate.= "...";
$paginate.= "<a class='button' href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
$paginate.= "<a class='button' href='$targetpage?page=$lastpage'>$lastpage</a>";
}
// End only hide early pages
else
{
$paginate.= "<a class='button' href='$targetpage?page=1'>1</a>";
$paginate.= "<a class='button' href='$targetpage?page=2'>2</a>";
$paginate.= "...";
for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page){
$paginate.= "<span class='current'>$counter</span>";
}else{
$paginate.= "<a class='button' href='$targetpage?page=$counter'>$counter</a>";}
}
}
}
// Next
if ($page < $counter - 1){
$paginate.= "<a class='button' href='$targetpage?page=$next'>></a>";
}else{
$paginate.= "<span class='disabled'>></span>";
}
$paginate.= "</div>";
}
$output .= "<div class='result'>".$total_pages.' Servers'."</div>";
// Pagination
$output .= "$paginate";
$output .= "</div>";
Open lgsl_class.php and find:
$mysql_query = "SELECT `id` FROM `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}` WHERE ".implode(" AND ", $mysql_where)." ORDER BY {$mysql_order}";
$mysql_result = mysql_query($mysql_query) or die(mysql_error());
And replace with this:
if(!isset($_GET['page'])) { $page = 1; } else { $page = $_GET['page']; }
$limit = (($page * 20) - 20);
$mysql_result = mysql_query("SELECT * FROM `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}` WHERE ".implode(" AND ", $mysql_where)." ORDER BY {$mysql_order} LIMIT $limit, 20") or die(mysql_error());
Open lgsl_list and put this code where you like to show pagination:
$mysql_query = "SELECT `id` FROM `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}` WHERE ".implode(" AND ", $mysql_where)." ORDER BY {$mysql_order}";
$mysql_result = mysql_query($mysql_query) or die(mysql_error());
And replace with this:
if(!isset($_GET['page'])) { $page = 1; } else { $page = $_GET['page']; }
$limit = (($page * 20) - 20);
$mysql_result = mysql_query("SELECT * FROM `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}` WHERE ".implode(" AND ", $mysql_where)." ORDER BY id LIMIT $limit, 20") or die(mysql_error());
Open lgsl_list and put this code where you like to show pagination:
include "lgsl_pagination.php";
PD: I tested only with e107 version. Lo cortez, no quita lo valiente... ahhh... yes e107 Rock
$mysql_query = "SELECT `id` FROM `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}` WHERE ".implode(" AND ", $mysql_where)." ORDER BY {$mysql_order}";
$mysql_result = mysql_query($mysql_query) or die(mysql_error());
And replace with this:
if(!isset($_GET['page'])) { $page = 1; } else { $page = $_GET['page']; }
$limit = (($page * 20) - 20);
$mysql_result = mysql_query("SELECT * FROM `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}` WHERE ".implode(" AND ", $mysql_where)." ORDER BY {$mysql_order} LIMIT $limit, 20") or die(mysql_error());
my code is lgsl_class.php
$mysql_query = "SELECT * FROM `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}` WHERE `ip` = '$ip' AND `q_port` = '$q_port' AND `type` = '$type' LIMIT 1";
$mysql_result = mysql_query($mysql_query) or die(mysql_error());
$mysql_row = mysql_fetch_array($mysql_result, MYSQL_ASSOC);
// CHECK IF SERVER IS IN THE DATABASE AND ADD IF REQUESTED
if (!$mysql_row)
{
if (strpos($request, "a") !== FALSE)
{
$mysql_query = "INSERT INTO `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}` (`ip`, `q_port`, `c_port`, `s_port`, `type`, `cache`, `cache_time`) VALUES ('$ip', '$q_port', '$c_port', '$s_port', '$type', '', '')";
$mysql_result = mysql_query($mysql_query) or die(mysql_error());
$mysql_row['id'] = mysql_insert_id();
}
else
{
echo "LGSL PROBLEM: REQUESTED SERVER NOT IN DATABASE: '$ip:$q_port:$c_port:$s_port:$type:$request'"; exit;
}
}
how to make the groups pages? pages is /index.php?stype=1&type=halflife , /index.php?stype=2&type=halflife