The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Facebook Share Button
Hello.
I am looking for a way to add a Facebook Share button to my articles that picks up the thread link, our logo image, and a properly formatted summary. So far I have no success in finding a way to do this in individual publications. I have a Tweet button that works great that I can insert into individual articles without the need for any template modifications. Has anyone come up with a way to add a Facebook Share button without template modifications? Thanks |
#2
|
|||
|
|||
There is no way to add anything to a page without modifying a template (even if there is an installer that does it for you, the template is still modified.) Why do you not want to modify a template?
|
#3
|
|||
|
|||
That's not true.
I have a Javascript Tweet button that works just fine and I can call Google maps from another Javascript - both directly from individual articles without template modifications. The Javascript Tween button looks like this: <a href="https://twitter.com/share" class="twitter-share-button" data-via="connectedcom" data-size="large">Tweet</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementB yId(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> A template modification affects every future article and I want more flexibility. |
#4
|
|||
|
|||
Quote:
This is an unusual methodology. Its been a while since I looked, but there is (or was) similar code that you could get from Facebook's site to put a like button on a web page—have you tried it and had it not work? |
#5
|
|||
|
|||
All of my publications are HTML.
I don't exactly manually paste. All of the publications are based on HTML templates created for the specific content. All I had to do was add the Javascript Tweet one time to each of the master templates. The Javascript code I got for for the Facbook button works to a point. I can't include my own logo graphic, I can't change the format to include a summary, and it doesn't work when viewed with Internet Explorer. This is the Javascript code I have for Facebook: <script>function fbs_click() {u=location.href;t=document.title;window.open ('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeU RIComponent(t), 'sharer','toolbar=0,status=0,width=6 26,height=436');return false;}</script><a href="http://www.facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank"> <img src= "/pictures/fb-share.jpg"></a> I need to figure out how to add the image and summary specifications. |
#6
|
|||
|
|||
Maybe somebody will come along who has more experience with this....but I think you need to set up "og codes" (which are a special form of meta tag) to tell facebook where to find those things.
|
#7
|
||||
|
||||
So something like (inside body tag)
HTML Code:
<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_GB/sdk.js#xfbml=1&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); } (document, 'script', 'facebook-jssdk')); </script> HTML Code:
<div class="fb-share-button" data-href="/showthread.php?$session[sessionurl]t=$thread[threadid]" data-width="The pixel width of the plugin" data-type="button"></div> |
#8
|
|||
|
|||
This is right from Facebook's documentation. It doesn't work.
|
#9
|
||||
|
||||
Works perfect, it all depends on whether you are using it correct, go to this thread http://www.thecodecage.com/forumz/sh...post1055010875 and at the very last post, left hand side above the reply button you'll see the share button i have just added using the above code, click it and you'll see it works!
|
Благодарность от: | ||
Krusty1231 |
#10
|
|||
|
|||
The Facebook Share is above the reply button. It is not inside the associated article which is what I want. Since you have html off the only way to do this is with a template modification.
I want to be able to position the share button next to the Tweet button in a publication like this: http://connectedcommunities.us/showthread.php?t=61647 I am close to getting it right. The button in this publication works, but not the way I want. It is missing the logo graphic and summary I want: http://connectedcommunities.us/showthread.php?t=61646 |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|