[TYPO3-english] page.jsInline strips parts of the JavaScript code
Peter Kraume
usenet at kraume.de
Tue Feb 8 12:26:11 CET 2011
Hi Jigal, Joey and Andreas,
thx for all your input!
Unfortunately my JS snippet wasn't complete. I removed the usage of TS
constants before posting it here. The original looked like this:
page.jsInline {
4711 = TEXT
4711.dataWrap (
window.fbAsyncInit = function() {
FB.init({
appId: '{$plugin.myext.appID}',
status: true,
cookie: true,
xfbml: true
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/{$plugin.myext.language}/all.js';
document.getElementById('fb-root').appendChild(e);
}());
)
}
Indeed, I didn't think of dataWrap searching for {} to replace.
Meanwhile I have found a solution for my problem:
page.jsInline {
4711 = TEMPLATE
4711 {
template = FILE
template.file = EXT:myext/pi1/myext.js
marks {
APPID = TEXT
APPID.value = {$plugin.myext.appID}
LANGUAGE = TEXT
LANGUAGE.value = {$plugin.myext.language}
}
}
}
In myext.js I've placed the two markers which are replaced by TypoScript.
Now I have a clean solution with the replaced JavaScript put in the
external JavaScript file (typo3temp/javascript_5f9fd517ad.js?1297163517)
and it is compressed as well.
In my opinion it's a better solution than using page.headerData
Cheers
Peter
More information about the TYPO3-english
mailing list