Jump to content

How to use explode() simul. with pages.


ted_chou12

Recommended Posts

by that, I mean i wish to create some virtual pages, such as "http://.../.../index.php?id=...0"
and two buttons, one going to the previous page, and the other going to the next page, however, whatever the page might be, it will have a certain number of explodes, eg. say 10 explodes, and no more than that, if more, the function adds a page. The explode function is below (although looks complicated, but it is very simple, others are my html codings that I wish to keep the page beautiful):
is actually two level, because i am trying to make a forum, so the numbers of postarray is infinite, since whenever a new post posts a comment, there will be a new set of $namee,$usernamee,...,$comment added to the text file. However, the number of second level, the explode function itself is definite, ie. it sticks with only 5 variables, they are $namee,$usernamee,$reply,$datetimee,$comment.
[code]
<?php
$postsarray = file("$include-file.php");
foreach($postsarray as $v) {
      list($namee,$usernamee,$reply,$datetimee,$comment) = explode("#",$v); //this is the explode function.

$file = "../users/" . $usernamee . "/poster.txt";
$aData = file_get_contents($file);

$file = "../users/" . $usernamee . "/display.txt";
$fh = fopen($file, 'r');
$bData = fread($fh, filesize($file));
fclose($fh);
echo '<table bgcolor="#FAEBD7" width="100%" align=center><tr bgcolor="#EEE8AA">&nbsp;</tr><tr><td align=center width="28%" bgcolor="#E0FFFF" valign=top><br><font face="arial" size=4><b>Posted by: ' .$namee . '</b></font><br><br><img src="' . $bData . '" height=100><br><br><font face="arial" size=4>Posts: ' . $aData . '</font><br><br><a href="../users/' . $usernamee . '/"><img src="hp.gif" height="30" width="30" alt="Personal Page"></a>&nbsp;&nbsp;<a href="../users/"><img src="pm.gif" height="30" width="30" alt="Send Private Message!"></a>&nbsp;&nbsp;<a href="../users/profiles.php?id=' . $usernamee . '"><img src="pf.gif" height="30" width="30" alt="See Profile"></a>&nbsp;&nbsp;<a href="../users/gb.php?id=' . $usernamee . '"><img src="gb.gif" height="30" width="30" alt="Guestbook"></a></td><td valign=top><font face="arial" size=5 color="#666666"><b>' . $reply . '</b></font><br><font face="arial" size=4><b>Posted: ' . $datetimee . '</b><hr>' . $comment . '</font></td></tr></table>' . "\r\n";}
?>
[/code]
So I will repeat it again to make myself clear, what i wish to do is to have ten sets of $namee,$usernamee,$reply,$datetimee,$comment, shown in one page, and another ten sets shown in a new page (*page 2), and page 3 when there are more than 20 entries and goes on forever and ever... until my host does not give me anymore space... :'(
Link to comment
https://forums.phpfreaks.com/topic/31156-how-to-use-explode-simul-with-pages/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.