[TYPO3] How to configure RTE to remove empty tagsets?

Peter Klein peter at umloud.dk
Thu Jan 24 14:13:29 CET 2008


A small change..
The line
  $strip[] = '%<'.$tag.'></'.$tag.'>%si';

Should be changed into:
   $strip[] = '%<'.$tag.'>\s*</'.$tag.'>%si';

this will strip tagsets which enclose whitespace chars too.

-- 
Peter Klein/Umloud Untd

"Peter Klein" <peter at umloud.dk> skrev i en meddelelse 
news:mailman.1.1201164322.28135.typo3-english at lists.netfielders.de...
> Hi Tyler.
> Where do you submit feature requests on bugtracker?
>
> BTW: I made a slight update (should be a couple miliseconds faster ;) )
>
> -- cut --
> <?php
> class user_parseFunc {
> function stripEmptyTags($content,$conf) {
>  $tags = explode(',',$conf['tagList']);
>  $strip = array();
>  foreach ($tags as $k => $tag) {
>   $strip[] = '%<'.$tag.'></'.$tag.'>%si';
>  }
>  return  preg_replace($strip, '', $content);
> }
> }
> ?>
> -- cut --
>
> -- 
> Peter Klein/Umloud Untd
>
> "Tyler Kraft" <tyler.kraft at netefficiency.co.uk> skrev i en meddelelse 
> news:mailman.1.1201085278.30842.typo3-english at lists.netfielders.de...
>> Hi
>>
>> Thanks, that is really handy :-)
>>
>> Would you submit this to typo3 bugs as a requested feature for 
>> parseFunc - There are many other times where I have wanted this!
>>
>> Tyler
>>
>>
>>
>>
>> Peter Klein wrote:
>>> Hi Tyler.
>>> Ok. then there's a reason why I couldn't find a TS solution :)
>>>
>>> I ended up with writing a small userFunct to remove those empty tagsets.
>>> Maybe it's useful for other who has the same problem?
>>>
>>>
>>> -- cut Typoscript SETUP - cut --
>>> page.includeLibs.user_parseFunc = fileadmin/scripts/parseFunc.inc
>>>
>>> lib.parseFunc.nonTypoTagUserFunc = user_parseFunc->stripEmptyTags
>>> lib.parseFunc.nonTypoTagUserFunc.tagList = b,strong,i
>>> lib.parseFunc_RTE.nonTypoTagUserFunc = user_parseFunc->stripEmptyTags
>>> lib.parseFunc_RTE.nonTypoTagUserFunc.tagList = b,strong,i
>>>
>>> -- cut Typoscript SETUP - cut --
>>>
>>>
>>> -- cut - File: fileadmin/scripts/parseFunc.inc - cut --
>>> <?php
>>> class user_parseFunc {
>>>  function stripEmptyTags($content,$conf) {
>>>   $tags = explode(',',$conf['tagList']);
>>>   foreach ($tags as $k => $tag) {
>>>    $content = preg_replace('%<'.$tag.'></'.$tag.'>%si', '['.$tag.']', 
>>> $content);
>>>   }
>>>   return $content;
>>>  }
>>> }
>>> ?>
>>> -- cut - File: fileadmin/scripts/parseFunc.inc - cut --
>>>
>>> The parameter "tagList" defines which tags should get processed.
>>>
>
> 




More information about the TYPO3-english mailing list