pinkp
pinkp

Reputation: 455

SilverStripe 3: Search Results template showing unwanted code

I'm using "$Content.LimitWordCountXML" in my search results template as shown here, but its showing results like this "Attendance[file_link,id=214]" when the content is a link, how do I stop it so its just shows the link text and no the code / ID? Thanks

Upvotes: 0

Views: 71

Answers (1)

3dgoo
3dgoo

Reputation: 15794

LimitWordCountXML is a function on the StringField class, not the HTMLText class. It acts as if the string variable it is working on is plain text, not HTML. Therefore it does not strip HTML.

We can use the HTMLText Summary function instead, which does strip HTML and accepts a word limit as the first parameter.

Upvotes: 2

Related Questions