Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » how do i fix this text BlogEntry formatting issue?

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

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

Page: 1
Go to End
Author Topic: 1170 Views
  • iandouglas736
    Avatar
    Community Member
    8 Posts

    how do i fix this text BlogEntry formatting issue? Link to this post

    When building a blog entry, if i use the 'code' element (or others that I've added to the mix), any double carriage-return gets parsed into a closing paragraph tag and a new opening paragraph tag.

    (i've had to replace the [ and ] marks and < and > tags but you'll see what I mean)

    So doing something like:
    {code}my first line of code

    second line{/code}

    This obviously causes XML errors, since the parsed content looks something like:

    (pre)my first line of code(/p)(p)second line(/pre)

    How would I 'fix' this, where the line feeds are all just interpreted as break tags instead of paragraph tags, only when in a 'code' element?

  • iandouglas736
    Avatar
    Community Member
    8 Posts

    Re: how do i fix this text BlogEntry formatting issue? Link to this post

    Found it ... sapphire/parsers/BBCodeParser.php

    Commented out this line around line 107 or so:

    $this->content = str_replace("\n\n", "</p><p>", $this->content);

    1170 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.