[TYPO3-english] Cleaner Typoscript dataWrap solution?

Loek Hilgersom loek at netcoop.nl
Wed Sep 24 16:16:16 CEST 2014


Hi all,

I'm staring at a Typoscript issue for which I have some solution, but it just 
looks too complicated for what it does. What I want is render a DB field, plus 
having the same content in the title-tag.

The simplest approach would be this:

10 = TEXT
10 {
	field = title
	dataWrap = <h3 title="{field:title}">|</h3>
	typolink < temp.typolink
	htmlSpecialChars = 1
}

But that will create an XSS issue in the title-tag, and on top of that, the 
whole thing will break miserably if there is a "|" in the title field (try it, 
it's fun!)

The solution below works, just as long as nobody enters ##12345&& in a title:

10 = TEXT
10 {
	field = title
	wrap {
		cObject = TEXT
		cObject {
			field = title
			htmlSpecialChars = 1
			wrap = <h3 title="|">##12345&&</h3>
		}
		splitChar = ##12345&&
	}
	typolink < temp.typolink
	htmlSpecialChars = 1
}

Anyone with a bright idea?

Loek


More information about the TYPO3-english mailing list