solved Twitter widget breaks page

MAD
MAD
@madc
10 years ago
600 posts
No matter where i put the timeline widget code it stops the page from loading ( White page )

This is my code
< a class="twitter-timeline" href="https://twitter.com/PunkBP" data-widget-id="434151298888249344" >Tweets by @PunkBP< /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 >

I created a template called twitter.tpl and added the include template in the header
It then loads the page but won't load anything after this call ( eg. no footer or index etc )

Any workaround with this?


--
~ https://punkbandpromotions.com ~
Check us out for all your Punk/Alternative Music!
Check us out on Facebook:- https://facebook.com/PunkBandPromotion

updated by @madc: 03/30/14 08:37:58PM
michael
@michael
10 years ago
7,717 posts
put a space between any { and the rest of the code.

eg BAD:
if(!d.getElementById(id)){js=d.createE

GOOD
if(!d.getElementById(id)){ js=d.createE

Same thing with any closing javascript }. just put a space.

Without a space, smarty things its smarty. with the space, smarty knows its javascript.
MAD
MAD
@madc
10 years ago
600 posts
Budda Bing Budda Bang!
Worked great. I was just working on a module to add this, as the module worked if the code was pasted into a field in the form.
Thanks @michael.
As usual you make it all seem so easy :p


--
~ https://punkbandpromotions.com ~
Check us out for all your Punk/Alternative Music!
Check us out on Facebook:- https://facebook.com/PunkBandPromotion

Tags