strip_tags
Description
Strips tags from an HTML string.
string strip_tags( string code )
Removes all HTML tags from the given string. Sometimes useful when simplifying messy RSS feeds. For converting larger objects or entire messages to text-only, see also the text() function.
Example
{strip_tags('<p>bit of <b>HTML</b></p>')} ---> bit of HTML
Use Case: You’re spidering content, but your CMS is adding HTML tags to your meta data. In order to have it properly rendered in the Sailthru template, you can use strip_tags() to remove any unnecessary HTML from the feed (in this case, the <i> and <b> tags).
Zephyr:{foreach content as c} {c.title}: {strip_tags(c.description)} {strip_tags(c.title)}<br/> {/foreach}
Output:Since the item in the feed that have HTML tags is the description for the iPhone story in the Media feed and Invisible Monsters description in the eComm feed, every other piece of content remains unaltered, but for those:
“Find out how you can get a <b><i>sneak peak</i></b> of Apple’s newest tech…” becomes “Find out how you can get a sneak peak of Apple’s newest tech…”
and“Love, betrayal, petty larceny, and high fashion fuel this deliciously comic novel from the author of <i>Fight Club</i>.” becomes “Love, betrayal, petty larceny, and high fashion fuel this deliciously comic novel from the author of Fight Club.”
Explanation: This script uses the strip_tags() function to remove any HTML tags from content from a data. This is useful if you spider content, and you’re spidering HTML tags that you don’t want affecting the style of your template.