We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Adding a Facebook like and Twitter follow button to the Sign-in page. [Solved] | Forum

Topic location: Forum home » Support » General Questions
Jordi
Jordi Mar 22 '15

I am trying to add both buttons to the sign in page.


The facebook button is working but when i add the java script fot the twitter button  i get a 500 server error. 


This is the working FB script

<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/nl_NL/sdk.js#xfbml=1&version=v2.0";

  fjs.parentNode.insertBefore(js, fjs);

}(document, 'script', 'facebook-jssdk'));</script>



and this is the twitter script


<a href="https://twitter.com/The_Other_Book" class="twitter-follow-button" data-show-count="false">Follow @The_Other_Book</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>


Who can help me?


site url is: https://theotherbook.com


The Forum post is edited by Taissa Mar 26 '15
Taissa Team
Taissa Mar 26 '15
Jordi,

If you have pasted this twitter code into the .html file, you need to place it within the {literal} {/literal} tags.

{literal} tags allow a block of data to be taken literally. This is typically used around Javascript or stylesheet blocks where {curly braces} would interfere with the template delimiter syntax. Anything within {literal}{/literal} tags is not interpreted, but displayed as-is.

But much better to paste a Javascript code using the Language keys.
Jordi
Jordi Mar 26 '15
Hi Taissa, i gonna try your tips!! what i did now to make it work is to put the script in a external file. And that works fine. 


but how can i do it with the language keys? 


Thanks!!! you are very clear in your answers and that's a big help! 

Taissa Team
Taissa Mar 26 '15
Jordi,
you are welcome :)
Quote from Jordi but how can i do it with the language keys?

The answer depends on the place where you would like to display the twitter button.
If you want to display it within the Sign-in box (see screenshot), you may use the Language key value.
For example, paste your script code within {text key='base+base_sign_in_txt'} text area.  Go to the Admin Area>Settings>Language section find and edit the language key value.
In other case edit the .html file.
The Forum post is edited by Taissa Mar 26 '15
Attachments:
  Screenshot.png (480Kb)
Jordi
Jordi Mar 26 '15
ahhh ok i understand....


i made it this way. have a look if you want. I also added a language selector on that page.


https://theotherbook.com



Taissa Team
Taissa Mar 26 '15
Good to know you have solved the issue. I'm going to mark this thread as Solved.