I'm trying to find a way to trim out whitespace from the beginning and end of a richtext content block.
I have a few lines like this:
This returns all text content that the current blog post contains and makes a 190 characters long except out of it. My problem is that when the blog post contains other than text elements there's a random amount of whitespace at the beginning of the excerpt.
I want to trim it away because it looks somewhat bad in my layout if the blog post excerpts start with a whitespace.
I automatically thought could I use the PHP trim() function to achieve this but I couldn't get it to work. I'm not even sure if it's possible to get Couch to spit out the excerpt and then run it through the trim() function.
As always, every bit of help and advice is greatly appreciated!
I have a few lines like this:
- Code: Select all
<p>
<cms:excerpt count='190' truncate_chars='1'>
<cms:show blog_content />
</cms:excerpt>
</p>
This returns all text content that the current blog post contains and makes a 190 characters long except out of it. My problem is that when the blog post contains other than text elements there's a random amount of whitespace at the beginning of the excerpt.
I want to trim it away because it looks somewhat bad in my layout if the blog post excerpts start with a whitespace.
I automatically thought could I use the PHP trim() function to achieve this but I couldn't get it to work. I'm not even sure if it's possible to get Couch to spit out the excerpt and then run it through the trim() function.
As always, every bit of help and advice is greatly appreciated!