Automatic page adding
Posted: Wed Dec 22, 2004 1:27 pm
Is there any way of making the content of a file split over a number of pages, I have a guestbook on a site and wondered if I could say after the 20th entry got to a page 2 and have 20 per page.
Below is the way in which the text is read, the text is retrieved from a txt file declared in the first couple of results.
The end result can be found here: http://www.nero-publications.co.uk/fall ... p?id=guest
Please help if you can any thoughts are welscome thanks, this is in the prototype stages and is an upgrade from the bands current and very nasty bravenet message board.
Thanks guys
Below is the way in which the text is read, the text is retrieved from a txt file declared in the first couple of results.
Code: Select all
<?php
$guest_file="php/form_data/guestbook.txt";
$pointer=fopen($guest_file,"r");
$lines_array=file($guest_file);
fclose($pointer);
$lines_array=array_reverse($lines_array);
print("
<center><TABLE CELLPADDING=3 CELLSPACING=0 BORDER=0 WIDTH=450>
<TR><TD>Welcome to the guestbook this is where you guys have your say about the band and the site.<BR> <a href=?id=guest_add>[Add Entry]</A> <A href=?id=guest_remove>[Remove Entries]</A><BR><BR>
</TR>");
for($i=0; $i<count($lines_array); $i++) {
$lines=count($lines_array);
$line_array=explode("ยก",$lines_array[$i]);
$date=$line_array[0];
$name=$line_array[1];
$news=$line_array[2];
$view=$line_array[3];
print("
<center><TABLE CELLPADDING=3 CELLSPACING=0 BORDER=0 WIDTH=450>
<TR><TD bgcolor=E0E0E0><FONT COLOR=#484848><B>$date</B> by <B>" .ucfirst($name). "</B></TD></TR>
<TR><TD VALIGN=TOP CLASS=JUSTIFY><FONT COLOR=#717171>$news</TD></TR>
<TR><TD VALIGN=TOP class=footer><I># " .(($lines-$i)-1). "</I></TD></TR>
</TABLE>\n<BR>\n");
}
?>Please help if you can any thoughts are welscome thanks, this is in the prototype stages and is an upgrade from the bands current and very nasty bravenet message board.
Thanks guys