Text trim
If you have Views' module installed, you can use its <a href="http://api.drupalize.me/api/drupal/function/views_trim_text/7">viewstrimtext()</code></a> function to programmatically trim field value (or any other text for that matter) to a specified length from your code.
Usage: viewstrimtext($alter, $value)</code>
<b>$alter:</b>
<ul>
<li><b>maxlength:</b> Maximum lenght of the string, the rest gets truncated.</li>
<li><b>wordboundary:</b> Trim only on a word boundary.</li>
<li><b>ellipsis:</b> Show an ellipsis (...) at the end of the trimmed string.</li>
<li><b>html:</b> Take sure that the html is correct.</li>
</ul>
Written by Maciej Zgadzaj
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Drupal
Authors
Related Tags
#drupal
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#