Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

why is the blog summary paragraph injecting line breaks?


Go to End
Reply


11 Posts   5532 Views

Avatar
Hamish

Community Member, 712 Posts

12 July 2008 at 7:35am

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.

Avatar
hendy

Community Member, 2 Posts

6 August 2008 at 9:36pm

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();   
}

Avatar
Hamish

Community Member, 712 Posts

7 August 2008 at 4:22pm

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?

Go to Top