Jump to:

23377 Posts in 18296 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » *bold* erm?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2
Go to End
Author Topic: 1771 Views
  • banal
    Avatar
    Community Member
    901 Posts

    Re: *bold* erm? Link to this post

    Have a look at this post where a very simple parser is explained: http://silverstripe.org/general-questions/show/260299
    Or here for a slightly more complex parser: http://doc.silverstripe.com/doku.php?id=recipes:syntax-highlighting

    But mind you, this won't be a simple task if you want to be sure you always end up having valid html. Probably the best approach would be to build some finite state machine that runs through the content and makes sure, opened tags get closed again...

    Update: You could also write a custom method for this in the blog controller (like you mentioned in your previous post). The TextParser is a more generic approach though. TextParsers can be used on any "Text" or "HTMLText" Datafield.

  • mhull
    Avatar
    Community Member
    79 Posts

    Re: *bold* erm? Link to this post

    banal, thank you for your comments but I think this is beyond my abilities.
    I guess I assumed that something similar would have been done before, or that there would be some documentation somewhere that I couldn't find. I am surprised this hasn't been an issue for others who want limited content and styles/images etc.

    For now I think I may be best using $Content.Summary(40)
    which at least doesn't show asterisks, but won't allow the bold text to be shown when it appears in the content.

    1771 Views
Page: 1 2
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.