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.

General Questions

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

How can I manipulate HTMLText Content?


Go to End
Reply

9 Posts   1326 Views

Avatar
DeklinKelly

7 October 2010 at 4:10am Community Member, 197 Posts

I want to create a special function to manipulate HTMLText Content.

So this should return the manipulated $Content
$Content.Foobar

Avatar
Martijn

7 October 2010 at 4:26am Community Member, 271 Posts

Thats where the TextParser is for :)

http://doc.silverstripe.org/recipes:syntax-highlighting#text-parser

Simple example I use :

http://www.sspaste.com/paste/show/4cac633e6fcd6

Avatar
DeklinKelly

7 October 2010 at 4:53am Community Member, 197 Posts

Thanks! Does it also work for Varchar?

Avatar
Martijn

7 October 2010 at 5:24am Community Member, 271 Posts

I tried to apply it to a TextField, but that does not seems to work...

Avatar
swaiba

7 October 2010 at 5:35am Forum Moderator, 1796 Posts

If you were to look at the docs or the code it would be obvious that the Parse method is only in 'class Text'

http://api.silverstripe.org/trunk/sapphire/model/Varchar.html
http://api.silverstripe.org/trunk/sapphire/model/Text.html

Avatar
Martijn

7 October 2010 at 5:40am Community Member, 271 Posts

Trying was quicker at the moment ;)

Avatar
swaiba

7 October 2010 at 5:46am Forum Moderator, 1796 Posts

Martijn the comment wasn't really directed at you, it was for others I feel the need to remind of how easily something can be checked in help / api docs / code.

Personally I use netbeans it is very fast to check code for an existing method (as the code completion is correct and fast) and the for docs I keep a short cut to http://api.silverstripe.org/trunk/elementindex.html and Ctrl+F searches fast too.

Avatar
DeklinKelly

7 October 2010 at 7:49am Community Member, 197 Posts

Is there a way to do this that would work with Varchar as well as Text and HTMLText?

Go to Top