I didn't need it, but it's a good idea. I didn't test all the scenarios where the line breaks are added and it is entirely possible that there are some where spaces are stripped.
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
- Previous 10 entries
- 1
- Page 22(current)
Thanks so much for this fix, Hamish. It was a very annoying problem for me. I also needed a sentence summary of each post, so I adapted your fixed function:
function SentenceSummary(){
$content = new Text('Content');
$content->value = Convert::raw2xml($this->Content);
$firstParagraph = preg_replace( '/((\n)|(\r))/', ' ', $content->FirstSentence());
$parser = new BBCodeParser($firstParagraph);
return $parser->parse();
}
In trac it appears this has been fixed properly, although it hasn't made it to release. This is the newer fix, which should work without the dodgy preg_replace's.
$parser = new BBCodeParser($this->Content);
$html = new HTMLText('Content');
$html->setValue($parser->parse());
return $html->FirstParagraph('html');
Still waiting for an official next release of the blog module.. maybe they just assume that everyone uses subversion?
- Previous 10 entries
- 1
- Page 22(current)