+ 1

Forums webpages

I am wondering how it works to create a website like a forum or a website with news, where you have many pages and you can select page 1, 2, ... 10, 11. I guess each article is store in a DB and with php we display them, but you need to create html pages dynamically? I noticed on some websites that in the url we can see url...?page=10. How does this work?

16th Mar 2020, 9:06 AM
Mickaël TREZZY
Mickaël TREZZY - avatar
2 Antworten
+ 1
There are many ways to do this and many pagination plugins out there. But for simple pagination you can do this. 1. Get the page value in the url with $page = $_GET['page'] 2. In the sql code to get results from the database should be like this 'SELECT ... FROM ... LIMIT '. $page*10 . ', 10' What this does is it filters the result starting from (page*10) and gets the next 10 results.
16th Mar 2020, 9:47 AM
Ore
Ore - avatar
0
Ok I see, thanks. I will search about pagination plugons.
16th Mar 2020, 8:14 PM
Mickaël TREZZY
Mickaël TREZZY - avatar