Hi,
I’ve now reached the stage where living without Modx is not an option.
I have a quick query -
I have a blog running at the mo and I want the meta description to be the same as a TV for that document. This isn’t an issue; it’s just that the TV has rich text content and I need the description to have all the formatting stripped away.
Is there a simple way to do this?
Thanks.
-
☆ A M B ☆
- 24,524 Posts
Make a snippet to grab the TV and use strip_tags() on it.
http://il.php.net/strip_tags
-
☆ A M B ☆
- 24,524 Posts
Should only take two or three lines of code; check the
API docs for getting the value of a TV, then run that through the strip_tags() function, then return that. Will be a good one to learn on
-
MODX Staff
- 730 Posts
Another way to accomplish this is with PHx.
If you install PHx, then all you have to do is output this in your template:
http://wiki.modxcms.com/index.php/PHx#strip
PHx can break things in some situations - recursive or nested tags, because it replaces some of the core parser. But I have it installed on every site I do, and can’t live without it now. And the functionality it brings is going to be part of the new core in 0.9.7.