Help with some PHP code...
Posted: Fri Nov 14, 2003 9:39 am
Hey all,
I'm using this PHP code to post comments on my site.
But now I want to set a max number of comments allowed to 75 and once 75 comments have been posted, I want the text input forms to be removed/hidden, so that only the comments themselves are shown.
In the PHP code, $i represents each comment, so I figure an if/else command could be used where if $i equals 75, the code between the two sets of ****** below is removed/hidden.
Can anyone help me/tell me how this can be done?
I'm using this PHP code to post comments on my site.
But now I want to set a max number of comments allowed to 75 and once 75 comments have been posted, I want the text input forms to be removed/hidden, so that only the comments themselves are shown.
In the PHP code, $i represents each comment, so I figure an if/else command could be used where if $i equals 75, the code between the two sets of ****** below is removed/hidden.
Code: Select all
<html>
<head>
<title>YourWebsite.com - Comments</title>
<link rel="stylesheet" href="comments.css" type="text/css">
<style type="text/css">
<!--
a {font-weight:bold; text-decoration:none}
.comment {font-family:<? echo $font_face; ?>; font-size:<? echo $font_size; ?>}
.date {color:<? echo $font_altcolor; ?>; font-family:<? echo $font_face; ?>; font-size:<? echo $font_size; ?>; font-weight:bold}
.form {color:<? echo $form_text; ?>; font-family:<? echo $font_face; ?>; font-size:<?echo $font_size; ?>}
.input {width:100%}
//-->
</style>
<base target="_blank">
</head>
<body alink="<? echo $body_alink; ?>" bgcolor="<? echo $body_bgcolor; ?>" leftmargin="0" link="<? echo $body_link; ?>" marginheight="0" marginwidth="0" text="<? echo $body_text; ?>" topmargin="0" vlink="<? echo $body_vlink; ?>">
<form method="post" name="frmPost" target="_top">
<center>
<table cellpadding="10" cellspacing="1" width="364" style="border-color:#673922;border-width:2px;border-style:solid;">
<? for($i = $countStart; $i != $countEnd; $i += $countInc) { ?>
<tr>
<td bgcolor="<? echo $table_bgcolorї$i % 2]; ?>" class="comment">
<? echo $commentї$i]; ?>
</td>
</tr>
<? } ?>
******
<tr>
<td bgcolor="<? echo $form_bgcolor; ?>">
<table border="0" cellpadding="4" cellspacing="0" width="100%">
<tr>
<td align="left" class="form" colspan="2" valign="middle" width="100%"><b>Add your comment:</b> (Auto-line breaks enabled.)</td>
</tr>
<tr>
<td align="left" class="form" valign="middle" width="1%">Name:</td>
<td align="left" valign="middle" width="99%"><input class="input" maxlength="50" name="commentName" size="40" type="text" value="<? echo $commentName; ?>"></td>
</tr>
<tr>
<td align="left" class="form" valign="middle">E-mail:</td>
<td align="left" valign="middle"><input class="input" maxlength="75" name="commentMail" size="40" type="text" value="<? echo $commentMail; ?>"></td>
</tr>
<tr>
<td align="left" class="form" valign="middle">Web Site:</td>
<td align="left" valign="middle"><input class="input" maxlength="100" name="commentSite" size="40" type="text" value="<? echo $commentSite; ?>"></td>
</tr>
<tr>
<td align="left" class="form" valign="top">Comment:</td>
<td align="left" valign="top"><textarea class="input" cols="38" name="commentText" rows="5" wrap="virtual"></textarea></td>
</tr>
<tr>
<td><br></td>
<td><input class="comment" name="Submit" type="submit" value="Submit"> <input class="comment" name="Cancel" onclick="void(window.close())" type="button" value="Cancel"></td>
</tr>
******
</table>
</td>
</tr>
</form>
</table>
</center>
</body>
</html>