Jump to content

Limit characters or words of textarea on certain template


Martinus
 Share

Recommended Posts

I searched the forums, API and Docs on Textarea field, but could not find how to limit characters or words in a certain template. I am wondering if there is such a thing in Processwire or do I need to use PHP functions?

my code is

<p>{item->summary}</p>

 

Link to comment
Share on other sites

To limit how many characters can be input, to go the field settings and set "maximum length" in the Input tab to a value greater than 0. You can also do this per template if you switch to a template using the dropdown in the upper right corner. Or you can go to the template settings and click the field there.

To shorten the string during output, you can use WireTextTools: WireTextTools::truncate() method - ProcessWire API

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...