Snippet: Template operator to strip strings for tags


<Tidemann> is there an operator that strips a string for tags?
<Tidemann> ...or removes images from an ezxml output


<Bratt> No, but you can make one really simple
 <Bratt> using simpletags()
 <Bratt> Set up this in template.ini: [SimpleTagsOperator], TagList_NoTags[], TagList_NoTags[text]=;;strip_tags
 <Bratt> Then you can use simpletags( 'NoTags' )
 <Tidemann> Bratt: hmm.. nice... haven't seen simpletags before actually
 <Tidemann> Bratt: can I use the method here to enable a-tags too then?
 <Bratt> Sure, just set it up in template.ini
 <Tidemann> cool! thanx!
 <kracker> wow, i wish you would write that into eZpedia ...
<Bratt> Yes, I know.  Took some time before I realized how simple it could be done
<zurgutt> interesting
<Tidemann> Bratt: uhm.. TagList_NoTags[text]=;;strip_tags seems to remove everything
<Tidemann> {$child.data_map.intro.content|simpletags('NoTags')} <-- right?
<Bratt> Tidemann: Yes, that was the point.  If you want to keep a-tags, you need to set that up in template.ini
<Bratt> Add a line something like: TagList_NoTags[text]=<a>;</a>;strip_tags
<Bratt> But I would call it something other than NoTags then
<Bratt> KeepLinks, or whatever
<Tidemann> Bratt: I didn't realise it removed the content of the tag aswell...
<Bratt> Tidemann: A tag includes the content of it :)
<Tidemann> Bratt: hehe.. 

External reference