PHP code for auto generating page
|
What is the code or logic for making PHP code for auto generating page? for example : in 1 page got 10 news, after the news reach 11, the page will automatically go to second page which page 2 will contain 10 older news and page 1 contain 1 recently added news |
Re: PHP code for auto generating page
|
You want these articles first writing to a database to retrieve them from, after you've got those, then it's a matter of calling the first 10, or the most recent 10 from the table in your database. Each subsequent page then would read the next or the second most recent 10, and so on and so on. Just giving the logic and not the code, brain isn't up to doing actual work till tomorrow. Remember the core function of PHP is to read into a database and then display arranged information from said database. |
Re: PHP code for auto generating page
|
Okay. thank you. I will try doing it right away. |
Re: PHP code for auto generating page
|
If I understan correctly you want to show an ammount of lines from a long list in a page and then select from another list which page you want to see. here si the logic i used for a site i made, the main page could be page 1 by default. use page number as a variable, and look at the following logic. X = number of lines per page P = page I = first line to show on page L = last line to show in page I = (X*(P-1))+1 L = (X*(P-1))+X you can use a loop to show the correct ammount of line on the page, good luck.
if 2=1 then 2+2=?
|