MilboW Posted September 19, 2013 Share Posted September 19, 2013 http://puu.sh/4v6WV.pnghttp://puu.sh/4v6Wq.png Provided some pictures below, <?php // Page Initialization $level = ''; $page = 'post'; include($level.'includes/config.php'); // Variables $error = $success = ""; // Get Post Info if (isset($_GET['id'])) { $post = $POSTS->getPostById($_GET['id']); if (!$post) { if (isset($_SESSION['last_page'])) { header('Location: '.$_SESSION['last_page']); } else { header('Location: index.php'); } } } else { if (isset($_SESSION['last_page'])) { header('Location: '.$_SESSION['last_page']); } else { header('Location: index.php'); } } // POST - Reply if (isset($_POST['reply'])) { $reply = strip_tags(Clean($_POST['reply'])); if ($reply != "") { $time = time(); $DB->RowInsert('replies', array('post' => $post->id, 'posted' => $time, 'user' => $_SESSION['user_id'], 'content' => $reply)); $DB->FieldSet('posts', 'lastupdated', $time, 'id', $post->id); } else { $error = "Enter a Reply"; } } // Set Last Page $_SESSION['last_page'] = 'post.php?id='.$_GET['id']; ?> <?php include("parts/doctype.php"); ?> <head> <title><?php echo $post->title; ?></title> <?php include("parts/meta.php"); ?> </head> <body> <div id="whole"> <div id="header"><?php include("parts/header.php"); ?></div> <div id="main"> <h1><?php echo stripslashes($post->title); ?></h1> <div class="postrow"> <a href="user.php?id=<?php echo $post->user; ?>"><img class="usericon" src="images/users/<?php echo $DB->FieldGet('users', 'avatar', 'id', $post->user); ?>" alt="<?php echo $DB->FieldGet('users', 'firstname', 'id', $post->user); ?>" title="<?php echo $DB->FieldGet('users', 'firstname', 'id', $post->user); ?>"></a> <div class="posttext"> <p><?php echo stripslashes(nl2br($post->content)); ?></p> <?php if ($DB->FieldGet('users', 'permissions', 'id', $_SESSION['user_id']) == 1) { ?> <a href='delete_post.php?id=<?php echo $post->id; ?>'><img class="deleteicon2" src="images/delete.png" alt="Delete Reply" title="Delete Reply"></a> <?php } ?> <p class="timestamp"><?php echo date('F j, Y', $post->posted); ?> at <?php echo date('g:i a', $post->posted); ?></p> </div> </div> <?php $replies = $POSTS->getReplies($post->id); if ($replies) { foreach ($replies as $reply) {?> <div class="postrow"> <a href="user.php?id=<?php echo $reply->user; ?>"><img class="usericon" src="images/users/<?php echo $DB->FieldGet('users', 'avatar', 'id', $reply->user); ?>" alt="<?php echo $DB->FieldGet('users', 'firstname', 'id', $reply->user); ?>" title="<?php echo $DB->FieldGet('users', 'firstname', 'id', $reply->user); ?>"></a> <div class="posttext"> <p><?php echo stripslashes(nl2br($reply->content)); ?></p> <?php if ($DB->FieldGet('users', 'permissions', 'id', $_SESSION['user_id']) == 1) { ?> <a href='delete_reply.php?id=<?php echo $reply->id; ?>'><img class="deleteicon2" src="images/delete.png" alt="Delete Reply" title="Delete Reply"></a> <?php } ?> <p class="timestamp"><?php echo date('F j, Y', $reply->posted); ?> at <?php echo date('g:i a', $reply->posted); ?></p> </div> </div> <?php } } ?> <?php if ($USERS->checkLogin()) { ?> <div id="replybox"> <img class="usericon" src="images/users/<?php echo $DB->FieldGet('users', 'avatar', 'id', $_SESSION['user_id']); ?>" alt="<?php echo $DB->FieldGet('users', 'firstname', 'id', $_SESSION['user_id']); ?>" title="<?php echo $DB->FieldGet('users', 'firstname', 'id', $_SESSION['user_id']); ?>"> <form method='POST'> <?php if ($error != "") { print("<p class='error4'>".$error."</p>"); } ?> <textarea id="reply" name='reply'></textarea> <input type="submit" class="button" value="Reply"> </form> </div> <?php } ?> </div> <div class="clear"></div> <div id="footerhome"><?php include("parts/footer.php"); ?></div> </div> </body> </html> And the post.php Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/ Share on other sites More sharing options...
cataiin Posted September 19, 2013 Share Posted September 19, 2013 http://php.net/manual/en/function.nl2br.php Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/#findComment-1450269 Share on other sites More sharing options...
MilboW Posted September 19, 2013 Author Share Posted September 19, 2013 Does not help me Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/#findComment-1450273 Share on other sites More sharing options...
cataiin Posted September 19, 2013 Share Posted September 19, 2013 (edited) Ah, sorry. Then I saw you already use nl2br. Try to replace: <p><?php echo stripslashes(nl2br($reply->content)); ?></p> with: <p><?php echo nl2br(stripslashes($reply->content)); ?></p> Edited September 19, 2013 by cataiin Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/#findComment-1450274 Share on other sites More sharing options...
MilboW Posted September 19, 2013 Author Share Posted September 19, 2013 I tried to include the function, but nothing really happens, could you take a look at my code, and tell me what im doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/#findComment-1450275 Share on other sites More sharing options...
MilboW Posted September 19, 2013 Author Share Posted September 19, 2013 Well, now it doesnt show the message Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/#findComment-1450276 Share on other sites More sharing options...
cyberRobot Posted September 19, 2013 Share Posted September 19, 2013 Have you tried displaying the $reply->content variable as is (without nl2br, etc.)? What do you get in the source code? Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/#findComment-1450278 Share on other sites More sharing options...
MilboW Posted September 19, 2013 Author Share Posted September 19, 2013 Nothing happen. Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/#findComment-1450279 Share on other sites More sharing options...
cyberRobot Posted September 19, 2013 Share Posted September 19, 2013 You don't see anything when adding the following line of code? <?php echo $reply->content; ?> If it outputs something, what is the exact text? Also, I just noticed that there are two similar variables. Which one should we be focusing on? <p><?php echo stripslashes(nl2br($post->content)); ?></p> <p><?php echo stripslashes(nl2br($reply->content)); ?></p> Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/#findComment-1450280 Share on other sites More sharing options...
MilboW Posted September 19, 2013 Author Share Posted September 19, 2013 Both. Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/#findComment-1450281 Share on other sites More sharing options...
cyberRobot Posted September 19, 2013 Share Posted September 19, 2013 You don't see anything when adding the following line of code? <?php echo $reply->content; ?> If it outputs something, what is the exact text? Did you see my other question? Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/#findComment-1450293 Share on other sites More sharing options...
MilboW Posted September 19, 2013 Author Share Posted September 19, 2013 Same with rn's Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/#findComment-1450322 Share on other sites More sharing options...
PaulRyan Posted September 20, 2013 Share Posted September 20, 2013 (edited) MilboW, you replies aren't the greatest, 1 or a few word replies will not allow us to help you. Please show us the code inside the functions getReplies() and getPostById(). Edited September 20, 2013 by PaulRyan Quote Link to comment https://forums.phpfreaks.com/topic/282286-forum-system-wont-make-new-lines/#findComment-1450376 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.