Back | Reverse | Quick Reply | Post Reply |

PHP code for auto generating page
Link | by ZZ on 2009-07-04 00:44:47
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
Link | by seraphna on 2009-07-05 22:16:58
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
Link | by ZZ on 2009-07-06 21:55:21
Okay.
thank you.
I will try doing it right away.

Re: PHP code for auto generating page
Link | by OneOne on 2010-03-12 10:15:20
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=?

Back | Reverse | Quick Reply | Post Reply |

Copyright 2000-2024 Gendou | Terms of Use | Page loaded in 0.0022 seconds at 2024-12-30 11:44:44