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   1422 Views

Avatar
DeklinKelly

Community Member, 197 Posts

7 October 2010 at 4:10am

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

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

Avatar
Martijn

Community Member, 271 Posts

7 October 2010 at 4:26am

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

Community Member, 197 Posts

7 October 2010 at 4:53am

Thanks! Does it also work for Varchar?

Avatar
Martijn

Community Member, 271 Posts

7 October 2010 at 5:24am

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

Avatar
swaiba

Forum Moderator, 1804 Posts

7 October 2010 at 5:35am

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

Community Member, 271 Posts

7 October 2010 at 5:40am

Trying was quicker at the moment ;)

Avatar
swaiba

Forum Moderator, 1804 Posts

7 October 2010 at 5:46am

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

Community Member, 197 Posts

7 October 2010 at 7:49am

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

Go to Top