[TYPO3-english] How to add some specific code just next to opening body tag via Typoscript

UGUR KOCAK drugurkocak at gmail.com
Sun Nov 4 00:23:09 CET 2012


Hi,
I am using TYPO3 v4.7 to build a portal.
I need to insert Facebook Javascript SDK just after opening body tag as in the documents. I want to place Facebook social plugins via Typoscript. 
But I don't want to loose pageUID and page specific css classes.
The code I need to create is exactly like;

> <body id="pageUID-10" class="pagePID-1 pageRID-1 pageRID-10 pageCID-ABC layout-std-MCS langID-0 normalUser evening" data-twttr-rendered="true">
> <div id="fb-root"></div>
> <script>(function(d, s, id) {
>   var js, fjs = d.getElementsByTagName(s)[0];
>   if (d.getElementById(id)) return;
>   js = d.createElement(s); js.id = id;
>   js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
>   fjs.parentNode.insertBefore(js, fjs);
> }(document, 'script', 'facebook-jssdk'));</script>

body tag and other parameters are generated via that template;
/.../public_html/typo3conf/ext/tyaml/res/std_project/template_data/if20_basic/config/Tyaml_S_basic_80_page.ts


I read many pages about adding id or class parameters to body tag, bodyTagCObject. I tried the page.inlineJs command;
> page.jsInline {
> 10 = TEXT
> 10.value (
> document.write('<div id="fb-root"></div>');
> )
> 20 = TEXT
> 20.value (
> (function(d, s, id) {
> var js, fjs = d.getElementsByTagName(s)[0];
> if (d.getElementById(id)) return;
> js = d.createElement(s); js.id = id;
> js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
> fjs.parentNode.insertBefore(js, fjs);
> }(document, 'script', 'facebook-jssdk'));
> )
> }

 
The code above gives no error but I can't see any <div id="fb-root"></div>  in the page source.
Is there any way to insert some html and javascript code just next to <body .....> code via Typoscript?
Best Regards,
Ugur Kocak








More information about the TYPO3-english mailing list