This tutorial shows you how to make a ChatterBlock. ChatterBlocks are small windows where users can type in messages. They're also called Shout Boxes or TagBoards and are kind of like miniature chat rooms.
The iframe in chatter.html will load this 'View Chatters' page. You can format this page to look how you want the chatterblock to be displayed. Let's take a look at the code.
<body onload=window.setTimeout("location.href='view.php'",120000)> <?php include('chatter.php'); $q = "select * from chatterblock order by id desc "; $result = mysql_query($q); while ($row = mysql_fetch_array($result)) { $id = $row["id"]; $name=$row["name"]; $url = $row["url"]; $msg = $row["msg"]; echo "<b><a href=\"$url\" target=\"new\">$name</a></b>: $msg<hr>"; } ?>
Basically code selects all the entries in the chatterblock to be listed, in the order of oldest last, newest first (chronological order). I only put in some basic format to display the entries; you can insert CSS, tables or whatever you like inside this part. In the above code, a user's name is displayed in bold with a hyperlink to the url entered.
Note:It'll display the hyperlink regardless of whether a url is entered or not. if you want it to be more intelligent, run a simple if check to see if $url has a value. If $url is empty, then don't display the hyperlink.
The message is displayed at the side of the name. Each entry is separated by a horizontal rule.