Feature #15844
closedAPI needed to write HTML tags into the FE header tags directly
0%
Description
There is a function in setJS in class.tslib_fe.php which makes it possible to add JavaScript into the FE page.
However this writes
<script type="text/javascript">/*<![CDATA[*/ /*]]>*/ </script>';
directly. It shall however be possible to write the script tags directly.
This is needed to add a reference to a JavaScript file into the <header> tags with $TSFE in extensions.
<script type="text/javascript" src="typo3/ext/xajax/xajax_js/xajax.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
<!--
<script type="text/javascript">
var xajaxRequestUri="http://localhost/index.php?id=339";
var xajaxDebug=false;
var xajaxStatusMessages=false;
var xajaxWaitCursor=true;
var xajaxDefinedGet=0;
var xajaxDefinedPost=1;
function showArticle(){return xajax.call("showArticle", arguments, 1);}
function changeValue(){return xajax.call("changeValue", arguments, 1);}
function processFormData(){return xajax.call("processFormData", arguments, 1);}
</script>
<script type="text/javascript" src="typo3/ext/xajax/xajax_js/xajax.js"></script>
(issue imported from #M2901)
Updated by Franz Holzinger over 18 years ago
One solution is to write to $TSFE directly:
$TSFE->additionalHeaderData['tx_ttproducts-js'] = $code;
However an API for programmers would be better, esp. because it is easier to find than to dig into TYPO3 code.
Updated by Martin Kutschker over 18 years ago
What's the big difference between
$TSFE->additionalHeaderData['key'] = 'val';
and
$TSFE->addHeaderData('key', 'val');
Granted the latter is much better OO-style, but they have the same effect.
What seems to be missing is the documentation, not the API: the array IS the API.
Updated by Sebastian Kurfuerst over 18 years ago
Closing it, as there is no change required.
Greets, Sebastian