XF 2.1 Is there a template equivalent of wholewordtrim formatter?

Kevin

Well-known member
I'm working with a post content in a template and would like to strip it out to nothing but the condensed text. 'Snippet' allows me to strip out the formatting but I'm not seeing a way of also stripping out the whitespace like wholewordtrim in formatter.

Is there a way of stripping out a variable whitespace in a template? 🤔
 
The term wholewordtrim is actually the XF1 version of the snippet function in XF2.

So I'm slightly confused about what you're asking for - neither function is designed to do anything with whitespace.

Can you provide an example of what you want to achieve?
 
So I'm slightly confused about what you're asking for - neither function is designed to do anything with whitespace.
This is what happens when I'm online at 2AM local time. :D In my caffeine deprived state I only glanced at wholewordtrim in formatter and likely misinterpreted what it was doing.
Can you provide an example of what you want to achieve?
Sure, and I should've done that last night.... in short, in a template after grabbing the post snippet and after stripping everything out I might end up with something like this....
Code:
abc         123        

xyz 

456
... but would like to condense the result to also strip out the extra line breaks & spaces to just abc 123 xyz 456.

How I'm using the resulting text is in places like the title property of a href tag and alt tag of an img and would like to get the text as condensed as much as possible.

Thanks
 
Back
Top Bottom