19 Oct 2015

Text limit in Joomla

For com_content use the following:

<?php $truncated_text = JHtml::_('string.truncate', $this->item->introtext, 20); ?>
<?php echo $this->item->event->beforeDisplayContent; ?> <?php echo $truncated_text; ?>

For K2 use the following:

<?php echo JHtml::_('string.truncate', $this->item->introtext, 200); ?>