Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
This will make the newlines always go into the output even if there is some HTML code inside. Works quite well, if you use bbcode exclusively. The filter system is expected to be redone in Drupal 4.4.0, so these kind of hacks will not be needed...
// get the line breaks right:
// if (strip_tags($text, "<a><i><b><u><code><cite><strong>") == $text) {
$text = nl2br($text);
// }
Comments
Comment #1
gábor hojtsyThis is by design. If you have certain HTML tags in your posts, newlines will not be added by the Drupal core. The relevant code is in common.inc:
So if the text contains any of the above tags (after all filters, including bbcode executed), it will not get newlines...
Comment #2
(not verified) commentedWell, okay... it's by design...
But how can I modify my code in common.inc so it does break the lines how it's supposed to?
Any idea?
Could you please help me out here?
Comment #3
gábor hojtsyThis will make the newlines always go into the output even if there is some HTML code inside. Works quite well, if you use bbcode exclusively. The filter system is expected to be redone in Drupal 4.4.0, so these kind of hacks will not be needed...
Comment #4
gdboling commentedI am using Drupal 4.4.1 and bbcode 4.4.0 and this does not appear to have been resolved as stated.