Page 1 of 1

[SOLVED] Adding twitter widget/JS causes error..

Posted: Tue Jul 09, 2013 1:07 pm
by meatPopsicle
Hi again guys, I've been trying to add a bit of twitter code to my template, but it causes a bit of a problem.

I'm trying to add this:

Code: Select all

<div style="width: 200px;">
    <a class="twitter-timeline"  href="https://twitter.com/QueensTaunton"  data-widget-id="354565331076907008">Tweets by @QueensTaunton</a>
<__script__>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</__script>

</div>
...
but when I hit the apply button this pops up:

Code: Select all

Syntax Error in template "globalcontent:twitta" on line 3 "!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");" - Unexpected ",", expected one of: "}" , " " , ATTR
I know that the code works, as I have two servers to play with and it functions well when thrown into a plain page of its own (outside of CMSMS), but CMSMS seems to dislike it!

I've also tried adding the code as a global content block, but that gives the same response.

Am I missing something simple/obvious here?

Many thanks,
Fred

Re: Adding twitter widget/JS causes error..

Posted: Tue Jul 09, 2013 1:54 pm
by Rolf

Re: Adding twitter widget/JS causes error..

Posted: Tue Jul 09, 2013 2:07 pm
by meatPopsicle
Fantastic - worked like a charm :)

Thank you very much Rolf!

Re: Adding twitter widget/JS causes error..

Posted: Tue Jul 09, 2013 2:09 pm
by meatPopsicle
It's not a big problem, but how long do my posts need to be moderated for as a new user?

Thanks,
Fred

Re: [SOLVED] Adding twitter widget/JS causes error..

Posted: Tue Jul 09, 2013 4:18 pm
by calguy1000
It's currently 5.