Search code examples
expressionengine

Display only a portion of a text variable


I want to display only a portion of a text variable in expression engine. Is it possible to achieve it using only expression engine tags or with a bit of php?

i have a textArea custom field which is the text content of a blog {blog_text_content}, i want to display only the first 25 caracters.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eius... read more


Solution

  • You can use the "TrucHTML" plugin to do that. It is also "cleanly" cutting the HTML so that you do not end up with broken HTML in your excerpt.

    The plugin can be found here: http://utilitees.de/ee.php/trunchtml/

    In your case, you could use something like that after installing it:

    {exp:trunchtml chars="25"}{blog_text_content}{/exp:trunchtml}