ONLINE DOCS ONLINE DEMO – ajax version – refresh model UPDATE : 22.02.2012
  • correction of a small bug in 7_code.php file
UPDATE : 14.02.2012
  • 1 minor update to class_pagination.php – a variable replaced.
  • 1 new navigation model – numbers with refresh and ”...” between them, like 1 2 3…7 8 9…12 13 14 – settings can be made.
  • 1 minor change to all refresh navigation models – the page variable “p” from the _code.php file is no more in the nav file but where the class is called, in antelink variable, now you can change the variable name easily if you need another variable in URL
  • 1 new css class added


This is a php class made for split into pages content from mysql tables.

You have the two methods of paging content with refresh and with ajax, 3 navigation systems and several template files for displaying items in the database.

You can make settings in three ways:

from the settings file - set default - by admin
when you add your class - overwrite the default - by admin
through the navigation properties bar from browser - by user

How it works?

This class make a query into mysql in the specified table with some requests made in “where” field and then display content using a template, like this:

The class is called after you set 4 attributes: table, where field, template to display, page number
It is checked if other attributes are set when the class is called. if attributes are set, class initializes the variables with these values, if attributes are not set, it initializes the variables with values from settings file
Select rows from database
Calculate how many pages are displayed and write information from the database using the selected template
Import the type and style of navigation system

Ajax version makes the above steps first time, when it displays the first page. After that, the remaining pages are displayed dynamically using JavaScript and XML generated by php.

If you need more articles in the same row you have to set float:left to the template class. Number of articles in the same row is set in the settings file.

This class has 4 required attributes:

table name
where - that can be 1 for select all rows
name of the template file
current page number

The other attributes are optional:

sortby - sort rows by this field from mysql table
nav - name of the file for the navigation model, select it from nav folder
show  - set number of articles from mysql per page
arrange - sort rows "asc" or "desc"
//only for non ajax system
antelink - part of url that need to be placed in front of the page number e.g. index.php?id=1&page=
postlink - part of url that need to be placed after page number e.g. &sid=1&title=something

Settings You can set some default values for

nav - navigation system model
sortby - field name
arrange - asc or desc
page - start page number - default is 1
show - number of rows per page
ONLINE DOCS ONLINE DEMO – ajax version – refresh model

You May Also Like