onlyican Posted March 3, 2011 Share Posted March 3, 2011 hey all. It may have been dealt with. but I am ill and tired so please link or slap round the face to wake me up Basically, new project has a WYSIWYG style BBCode Editor (hey, bit like this here) Anyway, the new Line is killing me I have nl2br() but it aint doing anything Example Code //Dont say it, i know $str is a BAD variable name, but this is from a private function inside a class $str = nl2br($str); $regexURLPattern = '#(\[url\=(.*))(\])(.*)(\[/url\])#'; preg_match_all($regexURLPattern, $str, $arrMatches); for($i = 0; $i < count($arrMatches[0]); $i++){ $strNewLink = '<a href="'.$arrMatches[2][$i].'" target="_blank">'.$arrMatches[4][$i].'</a>'; $str = str_replace($arrMatches[0][$i], $strNewLink, $str); } so [url=http://www.example.com]Text[/url] // Outputs correctly [url=http://www.example.com]Not Idiot Proof[/url] // See what I did, added a new line like an idiot would, it now breaks Please help Link to comment https://forums.phpfreaks.com/topic/229472-bbcode-and-new-lines-grrr/ Share on other sites More sharing options...
onlyican Posted March 3, 2011 Author Share Posted March 3, 2011 Ignore above. Ill moment. Its sorted. Link to comment https://forums.phpfreaks.com/topic/229472-bbcode-and-new-lines-grrr/#findComment-1182273 Share on other sites More sharing options...
BizLab Posted March 3, 2011 Share Posted March 3, 2011 Don't forget to mark this as solved. Link to comment https://forums.phpfreaks.com/topic/229472-bbcode-and-new-lines-grrr/#findComment-1182335 Share on other sites More sharing options...
onlyican Posted March 3, 2011 Author Share Posted March 3, 2011 I would if I know how!! Link to comment https://forums.phpfreaks.com/topic/229472-bbcode-and-new-lines-grrr/#findComment-1182349 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.