XF 2.1 Truncate a text string in a template?

Perhaps try using snippet:
{{ snippet($yourString, 200) }}

Take a look at function fnSnippet in XF\Template\Templater.php
which in turn calls $formatter->snippetString and can use different options such as
'fromStart'
'stripBbCode'
'stripQuote'
'hideUnviewable'
'stripHtml'
'stripPlainTag'
'censor'
 
Back
Top Bottom