Вход Регистрация
Файл: _core/_class/page.php
Строк: 49
<?php

    
# mark core  v1.0
    # author Drk in
    # date 24.10.19     

    # class page

    
class page {

        CONST 
element 10;

        public function 
__construct($cn){

        
$elements self :: element;    

        
$page =  isset( $_GET['page'] ) ? abs(intval($_GET['page'])): 1;

        
$total ceil($cn $elements); 

        if (
$page 1$page 1;
        
        if (
$page $total$page $total;

        
$start abs($page $elements) - $elements;

        
$this-> page $page;

        
$this-> total $total;

        
$this-> start $start;

        
$this-> cn $cn;

        
$this-> elements $elements;

        
$this-> limit " LIMIT {$start}{$elements}";

        }

        public function 
get($url){

        
$cn $this -> cn;    

        
$elements self :: element;

        if (
$cn $elements):        

        
$page $this -> page;

        
$total $this -> total;    

        echo 
'<div class ="ma"><div class="wrapper"><div class="pag wbg"><div class="pagn pgl">
        <div class="pgar oh font0"><table class="table__wrap"><tbody><tr> 
        '
.( $page == '
        <td class="table__cell" width="35%"> <div class="pagw">   <span class="dis"> ← Назад </span></div> </td>' 
'
        <td class="table__cell" width="35%"> <div class="pagw"><a href="' 
$url '&page='.( $page ).'"> ← Назад </a></div></td>').'
        <td class="table__cell"><div class="pagw pagwb"><span class="blk"> '
.$page.' из '.$total.' </span></div></td>
        '
.( $page $total '
        <td class="table__cell" width="35%"> <div class="pagw"><a href="' 
$url '&page='.( $page ).'"> Вперёд → </a>   </div> </td>' '
        <td class="table__cell" width="35%"><div class="pagw"><span class="dis"> Вперёд → </span></div></td>'
).'
        </tr></tbody></table></div><div class="pagn pgl"> <table class="table__wrap"> <tbody><tr>
        '
.( $page == '
        <td class="table__cell"> <div class="pagw pagwr"><span class="cur mr">1</span></div> </td>'
:'
        <td class="table__cell"> <div class="pagw pagwr"><a href="' 
$url '&page=1" class="mr">1</a></div> </td>').'
        '

        if( 
$total ):
        for ( 
$i= - 6$i <= 6$i++ ):    
        echo 
'
        '
.( $page $i && $page $i $total  '
        '
.( $page ''.( $i == -&& $page $i '<td class="table__cell "><i class="dot">...</i></td>':'' ).'':'').'
        '
.( $i != 0  '
        <td class="table__cell"><div class="pagw pagwr"><a href="' 
$url '&page='.($page $i).'" class="mr">'.($page $i).'</a></div>':'
        <td class="table__cell"> <div class="pagw"><span class="cur">'
.($page $i).'</span></div> </td>').'
        '
.( $i == && $page $i $total '<td class="table__cell "><i class="dot">...</i></td>':'').'':'').'';    
        endfor;
        endif;
        if( 
$total >= ):
        for (
$i= - 2$i <= 2$i++):
        echo 
'
        '
.( $page $i && $page $i $total '
        '
.( $i == -&& $page $i '<td class="table__cell "><i class="dot">...</i></td>':'').'
        '
.( $i != '
        <td class="table__cell"> <div class="pagw pagwr"><a href="' 
$url '&page='.($page $i).'" class="mr">'.($page $i).'</a></div> </td>':'
        <td class="table__cell"> <div class="pagw"><span class="cur">'
.($page $i).'</span></div> </td>').'    
        '
.( $i == && $page $i $total '<td class="table__cell "><i class="di">...</i></td>':'').'':'').'';    
        endfor;
        endif;    
        echo 
'
        '
.( $page != $total '
        <td class="table__cell"> <div class="pagw"><a href="' 
$url '&page='.$total.'">'.$total.'</a></div> </td>':'
        <td class="table__cell"> <div class="pagw"><span class="cur">'
.$total.'</span></div> </td>').'
        </tr></tbody></table></div></div></div></div></div>'
;
        
        endif;    

        }    

    }    
?>
Онлайн: 1
Реклама