Result Pager

Hello, I’m interested in how you can change the output of pages, or more precisely, bind styles

<?php
    class Navigator
    {
        function __construct($all,$pnumber,$query='')
        {
            $this->all=$all;
            $this->pnumber=$pnumber;
            $this->query=$query;
            $this->page=isset($_GET['page']) ? (int)$_GET['page'] : 1;
        }
    function start()
    {
        $this->num_pages=ceil($this->all/$this->pnumber);
        if (isset($_GET['last']))
        $this->page=$this->num_pages;
        $this->start=$this->page*$this->pnumber-$this->pnumber;
        if ($this->page > $this->num_pages || $this->page < 1)
        {
            $this->page=1;
            $this->start=0;
        }
        return $this->start;
    }
    function navi()
    {
        if ($this->num_pages<2)
        return '';
        $buff='<div class="navigator">';
    for($pr = '', $i =1; $i <= $this->num_pages; $i++)
    {
        $buff.= 
        $pr=(($i == 1 || $i == $this->num_pages || abs($i-$this->page) < 2) ? ($i == $this->page ? " [$i] " : ' <a href="'.$_SERVER['SCRIPT_NAME'].'?module=adminuser&page='.$i.'&amp;'.$this->query.'">'.$i.'</a> ') : (($pr == ' ... ' || $pr == '')? '' : ' ... '));
    }
        return $buff.'</div>';
    }
}
/*$arr=range(1,100);
$n=new Navigator(100,5,'a=1');
echo $n->navi();*/
?>

here is the code of the pager, output accordingly via echo $n->navi();

actually how to tie this output to css


Answer 1, authority 100%

It’s good practice to separate logic and output….That is, output the navigator already in the template. Or do the following:

   function navi($class="some_default_class")
{

And then in the output do this:

$buff='<div class="navigator '.$class.'">';

Then, by writing styles for individual classes, you can display navigation in different ways…