2011-10-18, 03:12 PM
Hello,
if we use [PHP] MyCode, there is a problem with forum width - mybb post parser uses build-in php function to syntax highlight, but this function create text with non-breaking spaces. In effect, posts can be too wide and "damage" our forum. Also, we can't fix it using css.
I prepared small modification which change non-breaking spaces to normal spaces.
1. Open /inc/class_parser.php file.
2. Find (line ~826):
3. Add before:
4. Find (end of the file):
5. Add before:
6. Save file and upload to server replacing original.
It's all!
if we use [PHP] MyCode, there is a problem with forum width - mybb post parser uses build-in php function to syntax highlight, but this function create text with non-breaking spaces. In effect, posts can be too wide and "damage" our forum. Also, we can't fix it using css.
I prepared small modification which change non-breaking spaces to normal spaces.
1. Open /inc/class_parser.php file.
2. Find (line ~826):
// Send back the code all nice and pretty
3. Add before:
$code = preg_replace_callback('#( )+#', array($this, 'deleteNbsp'), $code);
4. Find (end of the file):
}
?>
5. Add before:
private function deleteNbsp($text)
{
return (strlen($text[0]) < 7) ? ' ' : $text[0];
}
6. Save file and upload to server replacing original.
It's all!