The actual appearance of comments pages, is strictly HTML.
The only complications come from how you are going to store the comments, such that comments will not be deleted when the user closes his browser ( like variables).
I choose to do it using files.
I write the comments to a file:
I add the new comment at the end of a txt file.
When someone wants to view the comments, I simply open the file and print out the comments. ( Its not quite as simple as it sounds..but not hard)
You must decide on a divider such to know when you have arrived at a new comment..
It becomes more complicated when you must delete the comments from a file...
I first create a form in HTML wich will POST to "addcomment.php3"
I send it
$name ( name of the person)
$comment ( the comment )
This is what addcomment.php3 looks like
<?PHP
//Set $fp to the end of $filename
$fp=fopen($filename, "a+");
fputs($fp," USER: " . $user);
fputs($fp,"\n");
$date=date("D, d F Y, H:i");
fputs($fp,"DATE: " . $date);
fputs($fp,"\n");
/
I dont remember why I wrote each word of $comment separately to the file... I think there was probly a good reason... this works /
fputs($fp,"COMMENT: ");
$arraycmt=explode(" ",$comment);
$numarray=count($arraycmt);
for($i=0; $i<$numarray; $i++)
{
fputs($fp,"$arraycmt[$i]" . " ");
}
fputs($fp,"\n");
fputs($fp,"***");
fclose($fp);
?>PHP
This should create a file which looks like this
<<
USER: CKC
DATE: 10 JUL, 2000, 20:23:10
COMMENT: This is where the comment is...many lines of it...
So now your viewcomment.php3 should recognize "" as the comment divider.
but since we then added a end of line char...
the comment divider is actually "\n"...
<?PHP
$fp=fopen($filename,"r");
print("<table border=\"2\" width=\"50%\"> <tr><td bgcolor=\"$toprowcolor\">comment: </td></tr>\n");
$star="***\n";
while (!feof($fp))
{
$buffer = fgets($fp,1024);
if(strcmp($buffer,$star)==0)
{
print("<br></td></tr>\n");
print("<tr><td>\n");
}
else
{
echo $buffer;
echo "<br>";
}
}
fclose ($fp);
print("</table>");
?>PHP
I hope this helps...
The code may not work as pasted... I only added what I thought relevant to your work.
Any questions... dont hesitate to e-mail me.
Good luck..
Andre