// ############ function makes a comment link (does the job of countlines too) // put this code somewhere on the top of each page which will need comments, between php tags. To insert a comment somewhere on the page, you will need to write: or if you want to specify particular text for the comment link. function makecomment($name, $message="::: discussion :::", $ctr=0) { // clear the file stat cache, whatever that means clearstatcache(); // stick some html in what the function will spit out - you can edit this to your liking, just as you can change the default content for $message in the function call // $result is the string the function will spit out. The function builds it step by step, adding bits and pieces to it as it goes along. $result = '

' . $message; // the file which contains the comments $commentfile=$_SERVER['DOCUMENT_ROOT'] . "/comments/" . $name . ".comment"; // check if comment file exists if (file_exists($commentfile)) { // read the file into $list, line by line $lines = file($commentfile); // go through each line, and increase the counter by 1 if a comment "tag" is found while(list($key, $val) = each($lines)) { if (stristr ($val, "")) { $ctr++; } } } // checks if there are comments if ($ctr > 0) { // adds the number of comments to the result $number=' ('.$ctr.")"; $result=$result.$number; } $result=$result."

"; return($result); }