Hi there,
I'm trying to embed twitter in a website for my friend (using the embed code taken from twitter), but when I paste the following code in the template in the <head> section, it doesn't work.
<__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>
cmsms wont let me save changes to the template and reports that there is a syntax error in the script. It works in Dreamweaver - what gives?
This link is supposed to call it or whatever.
<a class="twitter-timeline" href="https://twitter.com/MIRecordsAU" data-widget-id="348700854150377473">Tweets by @MIRecordsAU</a>
Loving CMSMS for the most part, still learning it.
thanks in advance for any help you can provide.
Adding a twitter feed?
Re: Adding a twitter feed?
CMSMS uses Smarty engine as a template system (and a very powerful one). Smarty uses the { and } as tags enclosing chars. Depending on your version of CMSMS you can use:
or
HTH
Code: Select all
{literal}
<__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>
{/literal}
Code: Select all
<__script__>!function(d,s,id){# notice this: you can use a space or a newline after the { and before the }
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>
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
-
- New Member
- Posts: 8
- Joined: Thu May 16, 2013 8:37 am
Re: Adding a twitter feed?
Thanks for the reply, definitely on the right track here.
I included the {literal} tags, which got rid of the syntax error, however the twitter feed doesn't show in the page when i include the html link... just shows the text - Tweets by @MIRecordsAU
I did a bit of searching and apparently other people are having the same problem, just not sure how to fix it.
I included the {literal} tags, which got rid of the syntax error, however the twitter feed doesn't show in the page when i include the html link... just shows the text - Tweets by @MIRecordsAU
I did a bit of searching and apparently other people are having the same problem, just not sure how to fix it.