1. Go to this page and download the library: Download molajo/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/ */
molajo / pagination example snippets
/** 1. Routing: simulates the Router */
DIR__ . '/RuntimeData.php';
/** 3. Get Mocked Data: could be any list of data */
>parameters->display_items_per_page_count
);
$mockdata = $data_instance->getData();
/** */
/** 4. Get Pagination Data (the main point!) */
/** */
$pagination_instance = new \Molajo\Pagination();
$row = $pagination_instance->getPaginationData(
// Configuration: variables your application must provide
$runtime_data->parameters->display_items_per_page_count, // How many items are displayed on each page?
$runtime_data->parameters->display_page_link_count, // 3 in this example => << < 1 2 3 > >>
$runtime_data->parameters->create_sef_url_indicator, // Should SEF URLs be returned? true or false
$runtime_data->parameters->display_index_in_url_indicator, // Should index.php appear in the URL? true or false
// Primary Data: the total number of rows that could have been returned for the primary data
$data_instance->getTotalItemsCount(),
// Router: data from your router to help build the URLs for the pagination links
$runtime_data->route->page, // URL for page on which paginated appears
$runtime_data->route->parameter_start, // Query parameter 'start', for example, "?start=3" or "/start/3"
array() // Other query parameters like "&tag=dog" or "/category/dog"
);
<nav>
<ul class="pagination">
if ((int)$row->first_page_number == (int)$row->current_start_parameter_number) :
curl -s https://getcomposer.org/installer | php
{
" "Molajo/Pagination": "1.*"
}
}
php composer.phar install
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.