Screen 1: http://i60.tinypic.com/venbm8.jpg
Screen 2: http://i62.tinypic.com/11tanut.jpg
Załączam kod:
Kod: Zaznacz cały
/**
* custom version of nl2br which takes custom BBCodes into account
*/
function bbcode_nl2br($text)
{
// It looks like this works. Can't put in multiple lines of whitespace, though.
// first, lets trim starting/trailing whitespace
$text = trim($text);
// temporarily replace one or more consecutive newlines
// into SOH characters (not used in normal text)
$text = preg_replace('~(\r\n|\n){1,}|$~', "\001", $text);
// convert remaining (i.e. single) newlines into html br's
$text = nl2br($text);
// finally, replace SOH chars with paragraphs
$text = preg_replace('/(.*?)\001/s', '<p>$1</p>' . "\n", $text);
return $text;
}