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

$Content.Summary() to show more than just first paragraph?


Reply


2 Posts   5216 Views

Avatar
deeve007

Community Member, 3 Posts

27 August 2009 at 1:03am

Hey,

I want to display 4 recent articles on the Homepage, and a certain number of words or characters for each article, so even if an article has a short first sentence it will show a little of the second sentence to ensure that all 4 have a consistent amount of text. $Content.Summary() ends at the end of the first paragraph.

Is this possible, and if so how is it done?

Avatar
deeve007

Community Member, 3 Posts

27 August 2009 at 1:32am

Okay, have found this page here: http://api.silverstripe.com/sapphire/model/Text.html

Now the issue here is that any option seems to either stripe HTML tags altogether, so no paragraph breaks, or else LimitWordCountXML adds extgra <br /> tags for no apparent reason within the text.