MrCreeky Posted September 29, 2008 Share Posted September 29, 2008 Using this code: <?php echo nl2br($row_rs1_events['description']); ?> In IE all the <br/> do not display in the right way. Using Firefox or Safari everything looks fine. What way should i be formatting the text to display correctly? Quote Link to comment Share on other sites More sharing options...
aebstract Posted September 29, 2008 Share Posted September 29, 2008 I don't see a <br /> tag anywhere.. unless I woke up completely blind of certain code today? You're leaving a lot of information/examples/code or something out here, I don't think you can get help unless you explain better, more code and possibly an example of the problem? Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 29, 2008 Share Posted September 29, 2008 Did you check the actual HTML code? It could be that the problem has to do with certain style properties. If the [br] tags are in the actual html code and just not rendered how you want, then that is NOT a PHP problem. Quote Link to comment Share on other sites More sharing options...
thebadbad Posted September 29, 2008 Share Posted September 29, 2008 Can't see why it shouldn't work. What do you mean by "not display in the right way"? Are the line breaks not displayed at all in IE? Quote Link to comment Share on other sites More sharing options...
MrCreeky Posted September 29, 2008 Author Share Posted September 29, 2008 Here is the link to the site. http://www.tbec.co.uk/index.php I have just used an extension I got for dreamweaver to add the convert new lines to break lines. All the extension add's is the nl2br to the string. Can't work out why it would show up on on Firefox but not IE. Quote Link to comment Share on other sites More sharing options...
CroNiX Posted September 29, 2008 Share Posted September 29, 2008 The page looks the same in FF3 and IE7 to me? Clear your cache maybe? Quote Link to comment Share on other sites More sharing options...
aebstract Posted September 29, 2008 Share Posted September 29, 2008 Or like I had stated 2 hours ago, post some code with a better description on your problem, cause so far there isn't really anything anyone will be able to do to help you with what you have given so far. Quote Link to comment Share on other sites More sharing options...
MrCreeky Posted September 29, 2008 Author Share Posted September 29, 2008 That's the only code inserted to the string. Should I have to call a function for this? I know it's not cashe as I have been testing it on two different computers. One a Mac using both Firefox and Safari, the other My MacBook Pro running windows XP and using IE7 FireFox and Safari. When using IE it losse's all the dubble break line information and only displays one new line. As an example, IE shows: Hello World This is the next line FireFox and the rest show it like this: Hello word This is the next line Quote Link to comment Share on other sites More sharing options...
thebadbad Posted September 29, 2008 Share Posted September 29, 2008 I see your problem. In FF3 there's an empty line between each paragraph (like there should), but in IE7 there's isn't. How come it uses <br> in FF3, and <br /> in IE7? Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 29, 2008 Share Posted September 29, 2008 I don't see any problems with the page, they both look exactly the same to me. See Attachments: [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
budimir Posted September 29, 2008 Share Posted September 29, 2008 In IE7 try: <?php echo "Hello World!</br>How are you doing today?"; ?> Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 29, 2008 Share Posted September 29, 2008 could it be because in IE, the br is formatted wrong? <br/> Should be (with the space): <br /> Quote Link to comment Share on other sites More sharing options...
MrCreeky Posted September 29, 2008 Author Share Posted September 29, 2008 I don't see any problems with the page, they both look exactly the same to me. See Attachments: If you look at the text on the left you will see in Firefox there are gaps where each new line starts. Hello world Hello world In IE this is showing as: Hello world Hello world ---------------------- No idea why the page is showing <br> in IE and <br/> in FF Quote Link to comment Share on other sites More sharing options...
thebadbad Posted September 29, 2008 Share Posted September 29, 2008 @The Little Guy Your screen shots don't look alike, there's no double line breaks in IE (there should be). I tried to remove all CSS from the page, and the double breaks displayed just fine in IE. So the problem lies in your CSS. Your code is pretty messy though (no offense), so good luck locating the problem. Quote Link to comment Share on other sites More sharing options...
MrCreeky Posted September 29, 2008 Author Share Posted September 29, 2008 The line TBEC was founded and affiliated to the Auto Cycle Union in 1988 when we organised six fun enduro's; we now run between eight and eleven events a year.<br /> <br /> Is hand typed on the page but IE still shows it wrong: TBEC was founded and affiliated to the Auto Cycle Union in 1988 when we organised six fun enduro's; we now run between eight and eleven events a year. The aim of TBEC is to provide newcomers with a gentle....... In Firefox the same text shows as it should be: TBEC was founded and affiliated to the Auto Cycle Union in 1988 when we organised six fun enduro's; we now run between eight and eleven events a year. The aim of TBEC is to provide newcomers with a gentle........ Quote Link to comment Share on other sites More sharing options...
MrCreeky Posted September 29, 2008 Author Share Posted September 29, 2008 Oh yes! The CSS is only simple for that filed: .maintext {font-family:Arial, Helvetica, sans-serif;font-size:12px;font-weight:lighterer;letter-spacing:0.1em;text-align:left;color: #000000;text-decoration: none;} .maintext a:link {color: #006600;text-decoration: none;} .maintext a:visited {color: #006600;text-decoration: none;} .maintext a:hover {color: #ffffff;text-decoration: none;background-color: #006600;} .maintext a:active {color: #ffffff;text-decoration: none;background-color: #006600;} Why would that loss's the BR information? Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2008 Share Posted September 29, 2008 This is a html problam, are u using html or xhtml what doctype u using please............ Quote Link to comment Share on other sites More sharing options...
thebadbad Posted September 29, 2008 Share Posted September 29, 2008 @OP That part shouldn't have any effect on that. Just try to remove some parts, then test etc., and narrow it down. BTW font-weight:lighterer; "lighterer" - are you serious? Maybe you should look into validating your markup and CSS. @redarrow Oh, that may be the case too, didn't think of that. Although I've never heard of a doctype causing double line breaks to become single. Quote Link to comment Share on other sites More sharing options...
MrCreeky Posted September 29, 2008 Author Share Posted September 29, 2008 Here is all the code from a test page I have just made, it all works fine until I add the Span tags <?php require_once('Connections/tbec.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_tbec, $tbec); $query_Recordset1 = "SELECT blog FROM chairman"; $Recordset1 = mysql_query($query_Recordset1, $tbec) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>BR Test</title> <style type="text/css"> <!-- .maintext {font-family:Arial, Helvetica, sans-serif;font-size:12px;font-weight:lighter;letter-spacing:0.1em;text-align:left;color: #000000;text-decoration: none;} .maintext a:link {color: #006600;text-decoration: none;} .maintext a:visited {color: #006600;text-decoration: none;} .maintext a:hover {color: #ffffff;text-decoration: none;background-color: #006600;} .maintext a:active {color: #ffffff;text-decoration: none;background-color: #006600;} --> </style> </head> <span class="maintext"> <?php echo nl2br($row_Recordset1['blog']); ?> </span> </body> </html> <?php mysql_free_result($Recordset1); ?> RE ererererer sorry I was rushing Quote Link to comment Share on other sites More sharing options...
MrCreeky Posted September 29, 2008 Author Share Posted September 29, 2008 http://www.tbec.co.uk/test.php Quote Link to comment Share on other sites More sharing options...
thebadbad Posted September 29, 2008 Share Posted September 29, 2008 Okay, does seem like a CSS problem then. You've also got a heap of javascript doing some manipulation. And the PHP blocks where you've used short open tags (<?) shows in the source code, so you'll need to fix that in order for the code to work. Quote Link to comment Share on other sites More sharing options...
thebadbad Posted September 29, 2008 Share Posted September 29, 2008 SOLVED by removing letter-spacing:0.1em; from the first line of CSS. Quote Link to comment Share on other sites More sharing options...
MrCreeky Posted September 29, 2008 Author Share Posted September 29, 2008 Odd, why would it do that? Thanks so much for you help, I have been trying to fix that for some time now, never thought to look at the CSS side of it. Next round on me Quote Link to comment Share on other sites More sharing options...
thebadbad Posted September 29, 2008 Share Posted September 29, 2008 No problem =) I was wondering about that too. I'm pretty sure the font also changed when the letter-spacing was removed? Pretty weird. Quote Link to comment 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.