DonkeyWhiskers Posted April 30, 2010 Share Posted April 30, 2010 Say I have a text field like this $text = " BLAH BLAH BLAH BLAH BLAH "; Those BBCode tags will be replaced with HTML sooner or later. I use the nl2br function to put in line breaks but nl2br will put a load of unwanted line breaks in there because of the BBCode tags. How do I stop it from putting in line breaks in between BBCode tags? Link to comment https://forums.phpfreaks.com/topic/200298-selectively-using-nl2br/ Share on other sites More sharing options...
947740 Posted April 30, 2010 Share Posted April 30, 2010 I don't see any BBCode tags. Perhaps putting it in a code box... Link to comment https://forums.phpfreaks.com/topic/200298-selectively-using-nl2br/#findComment-1051155 Share on other sites More sharing options...
DonkeyWhiskers Posted April 30, 2010 Author Share Posted April 30, 2010 Whoops sorry. I can't even edit my post for some reason so I'll repost it $text = " BLAH BLAH BLAH BLAH [table] [tr] [td]BLAH[/td] [/tr] [/table] "; Link to comment https://forums.phpfreaks.com/topic/200298-selectively-using-nl2br/#findComment-1051160 Share on other sites More sharing options...
947740 Posted April 30, 2010 Share Posted April 30, 2010 After you do the original replace, you could do another to replace "]\n" with "". Link to comment https://forums.phpfreaks.com/topic/200298-selectively-using-nl2br/#findComment-1051162 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.