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

Display Summary Content (How to Parse Out Images)


Reply

2 Posts   1433 Views

Avatar
edk

11 June 2010 at 9:10am Community Member, 39 Posts

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() etc...it 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.

Thanks,
Ed

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.

Avatar
Willr

11 June 2010 at 7:18pm Forum Moderator, 5511 Posts

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)