Помощь по скриптам | Нужна помощь с пагинацией (за оплату)
Всем привет, я хз что это за кусок кода но он не работает, точнее работает вот только отображает все одной страницей, а надо чтоб в одной странице было допустим по 10.. пагинацию над исправить скину Увеличиваем ставку на 500 руб....
Скрипт -> https://bym.guru/forum/download_attach.php?file_id=62412
________
посл. ред. 27.06.2019 в 18:13; всего 2 раз(а); by TheYaMus
Скрипт -> https://bym.guru/forum/download_attach.php?file_id=62412
<?php if($stats[$offset]):
for ($i = $offset; $i <= $stats->countPlayers(); $i++): $style = ($i%2===0) ? ' class="b"' : ''; $name = htmlentities($stats[$i]['nick']); ?>
<tr <?php echo $style; ?>>
<td width="10%" style="padding-left: 7px;"><?php echo $i; ?></td>
<td width="10%" style="padding-left: 7px;"><a href="?a=stats&n=<?php echo $i?>&id=<?php echo $server_id; ?>" title="Полная статистика игрока"><strong><?php echo $name; ?></strong></a></td>
<td width="10%" style="padding-left: 7px;" class="text-center"><?php echo $stats[$i]['kills'];?></td>
<td width="10%" style="padding-left: 7px;" class="text-center"><?php echo $stats[$i]['headshots'];?></td>
<td width="10%" style="padding-left: 7px;" class="text-center"><?php echo $stats[$i]['deaths'];?></td>
<td width="10%" style="padding-left: 7px;" class="text-center"><?php echo ceil( 100 * $stats[$i]['hits'] / $stats[$i]['shots'] ) . '%';?></td></tr>
<?php endfor; else: echo ' <td align="center" colspan="6"><strong>Статистики больше нет</strong></td> '; endif; ?>
</table>
</div>
<div class="well">
<?php echo pagination($stats->countPlayers(),15,10,$page,$server_id,''); ?>
</div>
________
посл. ред. 27.06.2019 в 18:13; всего 2 раз(а); by TheYaMus
pagination() функцию в личку.
Apeccc,
function pagination($total, $per_page, $num_links, $cur_page,$server_id, $url='', $style='pagination', $text=''){
$itemscount=$total+$per_page*$num_links;
$itemsperpage=$per_page;
$pagedisprange=$num_links;
$pagescount=ceil($itemscount/$itemsperpage);
$stpage=$cur_page-$pagedisprange;
if ($stpage<1) { $stpage=1; }
$endpage=$cur_page+$pagedisprange;
if ($endpage>$pagescount) { $endpage=$pagescount; }
if ($cur_page>1) {
$output .= '<li><a href="?p=1&id='.$server_id.'"><<</a></li> ';
$output .= '<li><a href="?p='.($cur_page-1).'&id='.$server_id.'"><</a></li> ';
}
if ($stpage>1) $output .= '... ';
for ($i=$stpage;$i<=$endpage;$i++) {
if ($i==$cur_page) { $output .= '<li class="active"><a href="#">'.$i.'<span class="sr-only">(current)</span></a></li>'; }
else{ $output .= '<li><a href="?p='.$i.'&id='.$server_id.'">'.$i.'</a></li>'; }
}
if ($endpage<$pagescount and $endpage !=$cur_page) $output .= '... ';
if ($cur_page<$pagescount and $endpage !=$cur_page) {
$output .= '<li><a href="?p='.($cur_page+1).'&id='.$server_id.'">></a></li>';
$output .= '<li><a href="?p='.$pagescount.'&id='.$server_id.'">>></a></li>';
}
return $text.'<ul class="'.$style.'">'.$output.'</ul>';
}
DELETED
25 февраля 2019, в 13:22
Delete
Cezarionis, без разницы, главное шоб работало.
Код выше.
Код выше.
Закинь все куски кода на pastebin.com
Router, какие тебе коды нужны?
Это все что есть
Это все что есть
TheYaMus, это не все, не вижу объявленной $offset
Ты скинул лишь нижнюю часть. А вдруг у тебя выше проблема?
Может ты вместо limit суешь кол-во всех записей, и поэтому она все показывает
Может ты вместо limit суешь кол-во всех записей, и поэтому она все показывает
Стр.: 1, 2