vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Facebook Share Button (https://vborg.vbsupport.ru/showthread.php?t=311270)

laura66a 05-12-2014 02:17 AM

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

darnoldy 05-12-2014 04:02 AM

Quote:

Originally Posted by laura66a (Post 2497390)
Has anyone come up with a way to add a Facebook Share button without template modifications?

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?

laura66a 05-12-2014 09:03 AM

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.

darnoldy 05-12-2014 03:37 PM

Quote:

Originally Posted by laura66a (Post 2497424)
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.

So, you have enabled HTML in posts, and are manually pasting that code into the body of those messages that you want to have the button?

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?

laura66a 05-12-2014 06:51 PM

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.

darnoldy 05-13-2014 12:04 AM

Quote:

Originally Posted by laura66a (Post 2497486)
I need to figure out how to add the image and summary specifications.

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.

Simon Lloyd 05-13-2014 12:30 AM

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>

Below goes Where you want the button to appear
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>
you can change the url...etc in the above.

laura66a 05-13-2014 01:15 AM

This is right from Facebook's documentation. It doesn't work.

Simon Lloyd 05-13-2014 02:10 AM

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!

laura66a 05-13-2014 09:08 AM

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


All times are GMT. The time now is 09:29 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01168 seconds
  • Memory Usage 1,740KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_html_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete