Skip to content

Instantly share code, notes, and snippets.

@2dpi
Created May 13, 2014 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2dpi/a540527a64f9f0093392 to your computer and use it in GitHub Desktop.
Save 2dpi/a540527a64f9f0093392 to your computer and use it in GitHub Desktop.
JOOMLA: truncate text blocks over the specified character limit (ie. word trim)
<?php
///////////////////////////////////////////////////////////////////////////////////
// ADD TEXT TO BE TRIMMED, SET TRIM LENGTH IN CHARACTERS, BREAK WORD, STRIP HTML //
// http://api.joomla.org/cms-3/classes/JHtmlString.html //
///////////////////////////////////////////////////////////////////////////////////
echo JHTML::_('string.truncate', $text, $length, true, false );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment