How to create Pagination in existing PHP based site


#1

I would like to add a facility pagination to my existing PHP based page.
What are the step and what are the change required ?


#2

Nobody knows how your webpage is structured, so it’s up to you to check the prerequisites. And what did you find out by yourself about how a pagination works? Step 1: learn PHP.


#3

What class & css need to include in what sequence ?
Where patch work required in loop ?


#4

Hi @bjbhatttalk Welcome to the SP forums. As allready mentioned by @chorn, we don’t know how your website is structured. Furthermore do we not know if you’re using PDO (absolutely recommended) or mysqli/mysql.

Try to be a bit clearer about the requirements… You can also do a Google Search


#5

All the pagination stuff I’ve seen (and you can browse down this forum for some examples) does it in code, by passing through the page number and calculating the limit values for the query, rather than using CSS. There’s a topic about auto-extension of search results (like this forum does when you scroll down) on here somewhere, too.


#6

It depends on a lot of things which w don’t know about your site.
For example, what type of content are you wanting to paginate? It could be one very long article divided into chapters, or it may be a long list of products displayed in a common format.
Then how are you storing the data? The article chapters may be separeate html files, or they may be stored in a database table, or it may be something completely different.
We don’t know, you tell us.


#7

Displaying the News from Database Table which contains text fields and image filed using php in html page

What parameters, variables, css and class need to apply for completing pagination.
What is sequence need to followup for above task ?
Is there any standard working example php based html available from which we can understand concept ?


#8

Thanks


#9

My existing site done which is not done by me.
It is very complex with code of pagination including number of css and other third part classes using complex structure with configuration.
How I would know which part required here ?


#10

How much experience do you have in PHP? Trying to change complex code is not a job for a beginner (I don’t mean give up, but just start with something less complex and work up), and some code can look more complex than it actually is if the original developer has not considered that others may need to change it.

I am confused, though - you say you want to create pagination, but then you say “it is very complex with code of pagination” which suggests it already has the feature.

If you do a search here for “pagination” there are plenty of threads that pop up - have you had a read through those to see whether any of them give you more to go on?


#11

Ok, Thanks