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, Ed, biapar, Willr, Ingo, swaiba

Display Summary Content (How to Parse Out Images)

Go to End

2 Posts   1867 Views


Community Member, 39 Posts

11 June 2010 at 9:10am

I have run into this in two places now. In a search result summary and also in Blog Summary. Here is the scoop:

When a content editor places an Image to be the first item in the Content Window in the WYSISWYG, when you try and use one the of the methods like $Content.Summary() does not really act as you may like. I have toyed with the idea of a new method that would parse out the <img> or a <div> etc...

Has anyone else run into this issue? What did you do for a solution.


PS: For the blog as a quick work-around I created a new field call "Excerpt". This is manual solution on the part of the content editor though as they would have to complete the field. This solution doesn't work for the Search Results though.


Forum Moderator, 5523 Posts

11 June 2010 at 7:18pm

You can use the <% control Content %>$Summary.NoHTML<% end_control %> which strips out all HTML. This works well in search results to remove all formatting (headers etc)