MyBB Community Forums

Full Version: Preformatting code... without the double line-breaks.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a question. I went in and change the MyBB code so that a "pre" tag gets wrapped around the code body, BUT the nl2br called after the code sections get escaped ruins the formatting. Since both newlines and BRs are used in a "pre" tag, I now have double linespacing everywhere.

How would I eliminate this?
Try this:

Open inc/functions_post.php and search for (line 44):
$message = nl2br($message);
Replace with:
$message = str_replace(array("\r\n", "\n", "\r"),"<br />",$message);
Bingo, that did it! Big Grin

That needs to be in by default though, both the preformat and the linebreak part. It's a standard in all other forum packages I've tried, and even phpBB has it.