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.

We've moved the forum!

Please use for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Better HTMLText summaries

Go to End



Community Member, 55 Posts

7 February 2017 at 8:18am

Edited: 07/02/2017 8:45am

I use the ->Summary() method to get a summary from a DBField object, but I'm not really happy with the generated summaries. The main reason being that it seems to only read <p>'s and skips for example headings (<h1>), sometimes resulting in a poorly representative summary and sometimes just a blank field (eg when the text only holds a html heading).

What would be a simple fix for a better summary? Perhaps someone has a custom summary method laying around.