hello dani and everyone here..

please help..
i try to create my own page number on my php file..
each pages, i wanna have page number at the bottom right..
some page call from the database.. so we dono how many pages it will take..
do u have any idea how to create it?
what languange should be use?
php? javascript? ..?
please help..

thank u

how do you mean?
you want to number each php-script you have? or do you have an output (like a forum, onlineshop etc) that you want to chunk up.

1) numbering you php-files: do it with en external text-file. write the name of the file and add a number:

index.php|1
main.php|2

You can then get the name of the php-script with

$PHP_SELF

and figure out the page-number from your textfile. That helps you to reorganize you project when adding or removing files from it.

2) splitting huge pages up:
When using a DB it is simple. First, get the number of rows:

SELECT COUNT(`ID`) FROM ...

. You can then restrict the output from MySQL for instance with

LIMIT 0,9

. That gives you the first 10 entries from you query. On page two you use

LIMIT 10,19

for the next ten entries and so on.
Using a textfile-system it is a bit fuzzier. Write similar functions like getallentries, getlimitedentries, and so on to keep you code tidy.

herm... its different sDjh,

i create a report.. this report are in php. it is created from combination of many different file. meaning.. at one main file, i just use @include to combine all other files..

some of this include file are shown data from databse. so, how to get a Sequence no for the page number..

please help

I hope I got you this time.

You have an index-file with a couple of includes

include("./report1/1.php");  //Page 
include("./report1/2.php");  //Page 2

and you want each page to have a unique ID at the bottom.
Do you know where the page ends or do you want to find out?

If you know, then you can just insert a running number.

$nb=1;
include("./report1/1.php");  //Page 
$nb++;
include("./report1/2.php");  //Page 2

If you have to find it out, than it shouldt be possible with CSS. I can't tell you exactly how (im not fluent to CSS) but I would start with something like:

<html>
<head>
<link type=stylesheet href="style.php?id=report1">

and then generate in style.php dynamic CSS-Script that numbers you pages.
But for CSS I guess you better ask in the "Web Design" Forum.

Regards.
Simon

This article has been dead for over six months. Start a new discussion instead.