adrianmak Posted January 21, 2016 Posted January 21, 2016 Let says , return first 20 words of a paragraph 1
BitPoet Posted January 21, 2016 Posted January 21, 2016 /* Using regular expression */ $firstTwenty = trim(preg_replace('/^\s*((?:\S+\s+){20}).*/', '$1', $inputText)); /* Using split and combine */ $firstTwenty = implode(' ', array_slice(explode(' ', $inputText), 0, 20)); 2
mr-fan Posted January 21, 2016 Posted January 21, 2016 https://processwire.com/talk/topic/3429-how-to-set-text-linecharacter-limits-in-templates/#entry33748 regards mr-fan 2
Ivan Gretsky Posted September 27, 2016 Posted September 27, 2016 I can't remember where and if it is even true at all, but it seems to me I saw some helper functions in PW to do exactly that - summaries limited by words + ellipsis. Does anyone know what I am talking about?
DaveP Posted September 27, 2016 Posted September 27, 2016 Ryan gave an example of how to do this in a blog post recently. 2
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now