PHP code example of ashtaev / pagination

1. Go to this page and download the library: Download ashtaev/pagination library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ashtaev / pagination example snippets


    
     use ashtaev\Pagination;
    
    $total= 1777;                  // The total number of items
    $page = 75;                    // The current page number
    $path = '/articles/[:page]';   // A URL for each page
    
    $pagination = new Pagination();
    
    $pages = $pagination->get($total, $page, $path);
    
    
 foreach ($pages as $page): 
 if($page['url']): 
 else: 
 endif 
 endforeach;