Skip to content
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.


Folders and files

Last commit message
Last commit date

Latest commit



28 Commits

Repository files navigation

#Pagination php class and php (C++) extension

Presents two variants of Pagination module. C++-extension & native-php. Both variants are workable. Identical interfaces, identical behavior.

This is a workable example. And you can even use it in your projects, but it was created with the aim of demonstrating how to rewrite the php code as an extension written in PHP-CPP.

##Installation First you need to install the library PHP-CPP. Perhaps if the compilation will fail or will not pass the tests, you will need to switch to a state in which the extension works exactly (v1.1). So, to install PHP-CPP:

git clone
git checkout v1.1
make test
sudo make install


git clone
cd myscrnav
make test
sudo make install

##How to use A usage example is in the source code:

Create the pagination-object of myScrNav from extension:

scr = new myScrNav($pageNom, $Count, '/url/to/page/'); 

Or from php class:

require 'php/class.screennav.php';
$scr = new ScreenNav($pageNom, $Count, '/url/to/page/'); 

Specify the necessary parameters:

$scr->setInterval(10);            // How many objects on the page
$scr->setPrefix('?qwe&part=');    // URL prefix
$scr->setPostfix('&prm=132');     // URL prefix
$scr->setSpace('...');            // Splitter blocks tabs
$scr->setCssName('newClassName'); // The css class name control unit paged output
$scr->setMidTab(15);              // see info.png
$scr->setMaxTab(5);               // see info.png
$scr->showCount(true);            // Whether to show the total number of items?

MidTab & MaxTab Additionally, the following methods are available to obtain calculated data:

getStartPos(); // The number of the first item on the current page (to fetch from database)
getLimitPos(); // The length of the list elements on the current page (to fetch from database)
getPageCnt();  // Number of pagination pages
getPageNo();   // The current number (calculated) of the current page
show();        // Returns the control-element to the paginal laying (html)

I.e. you can control the paginal laying out and make queries to the database on the basis of this pagination. Appearance, of course, fully customizable via css.


License BSD


pagination php class and php (C++) extension






No releases published


No packages published