Jump to:

23451 Posts in 18899 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Display Summary Content (How to Parse Out Images)

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

Page: 1
Go to End
Author Topic: 1416 Views
  • edk
    Community Member
    39 Posts

    Display Summary Content (How to Parse Out Images) Link to this post

    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.


    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.

  • Willr
    Forum Moderator
    5497 Posts

    Re: Display Summary Content (How to Parse Out Images) Link to this post

    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)

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.