Jump to content

[SOLVED] Using same function, getting different results


Lodius2000

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.