Search code examples
typo3typoscripttypo3-4.5

Remove all H tags from one page in typo3


I need to remove all the H tags in my homepage and replace it with some other tags. I tried in different ways using typoscript and nothing working.

Even the content.defaultHeaderType is also not working in my case. All the content elements ate processed using FCE.

Am using TYPO3 4.5.29 Thanks


Solution

  • To match all headers from within content, plugins, rte and so on an easy way could be the extension Ext:regex. It an old extension but good at all and we used it even in a TYPO3 6.x project.

    You can use it for your needs in this way:

    config.regex {
        # replace opening tags
        pattern1 = /<h[1-6]>/
        pattern1.replacement = <othertag>
    
        # replace closing tags
        pattern2 = /<\/h[1-6]>/
        pattern2.replacement = </othertag>
    
        # shorter - replace both tags
        pattern3 = /<h[1-6]>(.*)<\/h[1-6]>/
        pattern3.replacement = <othertag>$1</othertag>
    }
    

    It's untested but it should work for your needs.