By : websource Published On Saturday, September 07, 2024, 13:10 In PHP Scripts
About
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
item_in_row
ONLINE DOCS
http://www.websource.ro/pagination/ajax/docs/
ONLINE DEMO
http://www.websource.ro/pagination/ajax/demo.php – ajax version
http://www.websource.ro/pagination/ajax/demo2.php – refresh model