Adrian
Adrian

Reputation: 1002

TYPO3 menu - adding HTML tags to stdWrap.override

I made a menu in TypoScript in witch I override standard title by my own texts:

lib.menu = HMENU
lib.menu.special = list
lib.menu.special.value = 3304, 7753
lib.menu {
    1 = TMENU
    1 { 
        wrap = <ul class="menu">|</ul>  
        NO {
      allWrap = <li>|</li> 
      stdWrap.wrap = |
      ATagBeforeWrap = 1
      stdWrap.htmlSpecialChars = 1
      stdWrap.override = some text <br /> some text! || some text <br /> some text!
        }  
  }
}

But in output I have the menu with HTML tag as a text:

 - some text <br /> some text! 
 - some text <br /> some text!

How to parse the HTML tags as a HTML?

Upvotes: 0

Views: 1064

Answers (1)

Jost
Jost

Reputation: 5840

The problem is this line:

stdWrap.htmlSpecialChars = 1

It escapes the input of the stdWrap (in this case the result from the override) by replacing HTML special characters with their entities.

It should be used if the input is user-supplied or has user-supplied parts, in order to prevent you users from breaking the HTML output in the frontend or introducing XSS vulnerabilities. If the content is a hard coded text, you can safely leave it out.

Otherwise, you should only escape the user input, and add the HTML later, for example by using stdWrap.override.htmlSpecialChars = 1.

Upvotes: 2

Related Questions