truncate content block

Permalink 1 user found helpful
Hello, Sorry if this has been answered before, i have tried searching though but couldn't seem to find a proper solution.

Is there anyway of truncating a content block to a certain number of characters? The only way i've found to do it so far uses strip tags, and so doesn't show any of the styling which ideally isn't what I'm wanting to achieve.

Many thanks for any help.

P.s I'm new to Concrete5, but loving it so far!!

 
RadiantWeb replied on at Permalink Reply
RadiantWeb
Add just b4 the "print $content" the following

Also, this will include your tags in the count, so you may want to strip tags as well. Up to you.

$truncateChars = 120;//the number of chars
$content = substr($content,0,$truncateChars).'.....';
OliR replied on at Permalink Reply
great! thank you for the speedy response!
Robert2010 replied on at Permalink Reply
How can i do this for:

echo $blog_post->getBodyPreview();
if( $blog_post->hasBreakPoint() ) {
          printf('', $blog_post->getLink(), blog_t(''));
        }
      ?>


I dont want to use the Breakpoint but do want to use the truncate.

Thanks in advance!
Robert2010 replied on at Permalink Reply
someone? would be REALLY helpful
cannonf700 replied on at Permalink Reply
cannonf700
I'm not sure what to do but I think that clairec did something similar on her site. here's the thread.
http://www.concrete5.org/community/forums/chat/latest-news-area#535...

check out her website.http://www.gothinkdesign.com
She's got a great news area with truncated content from her blog.