Truncating text and specifying the amount of characters
Permalink
Hi There,
I need to truncate some a collection title to ensure it fits into a slider properly.
I'm loading the text helper at the top of the template like this:
Then displaying the title in the markup further down like this:
How do I limit the text to a specific character amount - after searching I found this so tried added at the top and where the markup is rendered but I obviously added to the wrong place.
Any help would be much appreciated.
Cheers
Ben
I need to truncate some a collection title to ensure it fits into a slider properly.
I'm loading the text helper at the top of the template like this:
$textHelper = Loader::helper("text");
Then displaying the title in the markup further down like this:
<p><?php echo $textHelper->shorten($cobj->getCollectionName(),$controller->truncateChars); ?></p>
How do I limit the text to a specific character amount - after searching I found this so tried added at the top and where the markup is rendered but I obviously added to the wrong place.
$truncateChars = 120;
Any help would be much appreciated.
Cheers
Ben
If this isn't the page list block then replace the "$controller->truncateChars" bit with just the number you want, so that line would look like this: