我正在尝试创建一个评论系统,用户可以在其中发表评论,然后其他用户可以回复这些评论。我希望实际帖子位于页面左侧,评论位于右侧,这样用户就不必滚动浏览实际帖子来阅读评论。我试过使用 position: absolute ,但这会干扰我的回复系统。有谁知道一个更简单的方法来做到这一点?
我的代码
while ($commentrow = mysqli_fetch_assoc($commentresult)) {
if (mysqli_num_rows($commentresult)==0) {
echo '';
}
else {
$commenterid = $commentrow['userid'];
$commentersql = "SELECT * FROM users WHERE userid = '$commenterid'";
$commenterresult = mysqli_query($conn, $commentersql);
while ($commenterrow = mysqli_fetch_assoc($commenterresult)) {
echo '<div class="PostComments">';
if ($commenterrow['profileimg'] == 1) {
$filename = "profilepics/profile".$commenterid."*";
$fileinfo = glob($filename);
$fileext = explode(".", $fileinfo[0]);
$fileactualext = $fileext[1];
echo "<div class='CommentProfilePicture'><img src='profilepics/profile".$commenterid.".".$fileactualext."?".mt_rand()."'></div>";
}
else {
echo "<div class='CommentProfilePicture'><img src='profilepics/noUser.png'></div>";
}
echo "<div class='CommentUserName'>".$commenterrow['userName']."</div>";
echo "<div class='CommenterComment'>".$commentrow['comment']."</div> </div>";
}
如果您有任何问题,我将非常乐意为您解答。
侃侃尔雅