display x-amount of characters from body field?

I think I know the answer to this question but I’ll ask anyway. Does anyone know if its possible to display only a certain amount of characters from the body field?

Basically we want to show only the first sentence or x-amount of characters from a field on a page. We’ll include a “read more” button, which once clicked will expand the page and show the full content. What I’m trying to avoid is having to creating another field on the content editor where the user would have to enter the collapsed text and then a second field for the expanded text.

Thoughts anyone?

Shane

How about this:

#set($bodystring = $sys.item.getProperty("rx:body").String)
#set($mystring_short = $bodystring.substring(0,100))
<div style="border: 1px solid #c00; margin: 2px 02px 0; padding: 5px;">
$mystring_short ...
</div>

Will give you the first 100 chars but will also include HTML tags so you may want to strip those out.

Great, seems simple enough, thank you Chris.

Shane