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 forum.silverstripe.org 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

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


Go to End


2 Posts   7082 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.