23364 Posts in 18125 Topics by 2862 members
Page: 1 2
|Go to End|
21 July 2009 at 8:56pm Last edited: 21 July 2009 9:00pm
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.
21 July 2009 at 9:34pm
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.
Page: 1 2
|Go to Top|