PDA

View Full Version : Double-Newlines


linolium
11-21-2006, 05:56 AM
Is this a known behaviour?

Newlines are translated into <br />'s once when a comment is posted (index.php, line 949 or so) and once when a comment is displayed (functions.php, line 84). So if you type something like this in the comments box:

That was a really great photo.
It could have been more colourful though.

Keep posting great photos!

...it ends up coming out like this:

That was a really great photo.

It could have been more colourful though.


Keep posting great photos!

Definitely looks bizarre with the double newlines. To "fix" it I just changed line 84 of functions.php to not pass the $comment_message through nl2br. Of course you could also change the other one, but then you would have to go through and delete all <br/>'s in existing comments.

austriaka
11-21-2006, 08:21 AM
thanks for the hint!

Dennis
11-21-2006, 09:47 AM
This behavior has been fixed in the upcoming release.

GeoS
11-21-2006, 09:00 PM
Fix was published on forum, please use search tool at the top of forum.

linolium
11-21-2006, 09:57 PM
Fix was published on forum, please use search tool at the top of forum.

Sorry, I had searched but couldn't find anything. Probably is just described differently though.

Dennis
11-22-2006, 05:27 AM
Well I'm in a helpful mood today: http://forum.pixelpost.org/showthread.php?t=614&highlight=nl2br+comments

There you go :)

linolium
11-22-2006, 08:48 PM
Well I'm in a helpful mood today: http://forum.pixelpost.org/showthread.php?t=614&highlight=nl2br+comments

There you go :)

Thanks schonhose, but that looks like the opposite of the problem I was having:

i've noticed when people leave comments on my site and they have line breaks, it stores properly in the database, but when displaying on the comment page, all the line breaks have been stripped out.

Whereas it was adding one too many line breaks for me.

Dennis
11-23-2006, 07:12 AM
Well the problem is that one to many nl2br is excecuted. I have a look at the svn to see where the problem was. I'll get back to you on that one.

linolium
11-23-2006, 09:58 PM
Well the problem is that one to many nl2br is excecuted. I have a look at the svn to see where the problem was. I'll get back to you on that one.

Um, I don't mean to be blunt or anything, but I have already found the problem and how to fix it, stated in the first post.

GeoS
11-23-2006, 11:26 PM
So Im closing this topic as problem is solved.

Dennis
11-24-2006, 06:13 AM
Um, I don't mean to be blunt or anything, but I have already found the problem and how to fix it, stated in the first post.

Ow... I need to read stuff first :P

[and closed the thread since issue is solved.]