Lodius2000 Posted September 7, 2008 Share Posted September 7, 2008 i am making a comments forum for my blog, the functions page_top() and page_bottom() are purely formatting functions that i use on every page, single.php is the display of a single article (duh) newsingle.php is the same display of a single article with the comments displayed and either a login or create a comment if you are logged in please look at http://maddenbain.com/single.php?id=37 //looks good http://maddenbain.com/newsingle.php?id=37 //looks bad feel free to change the id to anything lower than 37 to make sure that this is a consistent error, but specifically look at the formatting on the bottom of the blue box and where the green box gets moved to in newsingle.php. I cant seem to figure out what is screwing up the formatting. here is a snippet of the code that should display what you are seeing when you go to newsingle.php <?php function show_form_login($errors = '') { global $db, $row, $id; page_top(); print '<div class="entry">'; print '<div class="entrytitle">'; print "<h2>" . stripslashes($row['article_title']) . "</h2>"; print "\n</div>\n"; print '<p class="timestamp">Posted by <a href="mailto:' . $row[email] . '">'; print "$row[username]</a> at " . date('h:i A \o\n D. F j, Y.', $row['formatted_time']) ."</p>\n"; print "<br />\n"; $article = $row['article']; //replace new lines with <br /> $order = array("\r\n", "\n", "\r"); $replace = '<br />'; // Processes \r\n's first so they aren't converted twice. $new_article = str_replace($order, $replace, $article); print "" . stripslashes($new_article); print "\n"; print "<br /><br />\n"; print '<div style="clear:both;"></div>'; print "</div>"; $comments = $db->getAll("SELECT UNIX_TIMESTAMP(`time`) AS formatted_time, username, content FROM comments WHERE article_id = ?", array($id)); print "<h3>Comments</h3>\n<br /><br />\n"; foreach ($comments as $com){ print '<div class="comment">'; print '<div class="timestamp"> At '. date('h:i A \o\n D. F j, Y.', $row['formatted_time']); print '<div><span class="commentuser">' . $com['username'] . '</span> says:</div><br />'; print '<div class="commentcontent">' . $com['content'] . '</div>'; print '</div>';//class="comment" //open mainpage.css to help with this } if ($errors){ print 'Please correct these errors: <ul><li>'; print implode('</li><li>', $errors); print '</li></ul>'; } print "<div>\n"; print '<form name="login" method="POST" action="'.htmlentities($_SERVER['PHP_SELF']).'">'; //begin the unique form print "<table>\n"; print '<tr><td>Username:</td><td>'; input_text('username', $_POST); print "</td></tr>\n"; print '<tr><td>Password:</td><td>'; input_password('password', $_POST); print "</td></tr>\n"; print '<tr><td></td><td>'; input_submit('submit', 'Log in'); print "</td></tr>\n"; print '<input type="hidden" name="_submit_check" value="1" />'; print "</table>\n"; print '</form>'; print '<script language="JavaScript"> document.login.username.focus(); </script>'; print "<br /><br />"; page_bottom(); } ?> thanks for the help, lemme know if there is anything else i can give you to solve this notes: i am aware of general layout/formatting issues with current IE versions, please dont use IE //fix is in progress i am aware that logging in on newsingle.php does not work //trying to tackle the formatting first Link to comment https://forums.phpfreaks.com/topic/123185-solved-using-same-function-getting-different-results/ Share on other sites More sharing options...
btherl Posted September 8, 2008 Share Posted September 8, 2008 Here's are the differences between the two pages: -<div style="clear:both;"></div></div> +<div style="clear:both;"></div></div><h3>Comments</h3> +<br /><br /> +<div> +<form name="login" method="POST" action="/newsingle.php"><table> +<tr><td>Username:</td><td><input type="text" name="username" value=""/></td></tr> +<tr><td>Password:</td><td><input type="password" name="password" value=""/></td></tr> +<tr><td></td><td><input type="submit" name="submit" value="Log in"/></td></tr> +<input type="hidden" name="_submit_check" value="1" /></table> +</form><script language="JavaScript"> + document.login.username.focus(); + </script><br /><br /> The newly added div does not appear to be closed. Could that be the problem? Link to comment https://forums.phpfreaks.com/topic/123185-solved-using-same-function-getting-different-results/#findComment-636216 Share on other sites More sharing options...
Lodius2000 Posted September 8, 2008 Author Share Posted September 8, 2008 you are a freaking genious thanks so much for the second pair of eyes solved Link to comment https://forums.phpfreaks.com/topic/123185-solved-using-same-function-getting-different-results/#findComment-636223 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.