Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 05-12-2014, 02:17 AM
laura66a laura66a is offline
 
Join Date: Oct 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 05-12-2014, 04:02 AM
darnoldy darnoldy is offline
 
Join Date: Dec 2004
Posts: 234
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by laura66a View Post
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?
Reply With Quote
  #3  
Old 05-12-2014, 09:03 AM
laura66a laura66a is offline
 
Join Date: Oct 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 05-12-2014, 03:37 PM
darnoldy darnoldy is offline
 
Join Date: Dec 2004
Posts: 234
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by laura66a View Post
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?
Reply With Quote
  #5  
Old 05-12-2014, 06:51 PM
laura66a laura66a is offline
 
Join Date: Oct 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 05-13-2014, 12:04 AM
darnoldy darnoldy is offline
 
Join Date: Dec 2004
Posts: 234
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by laura66a View Post
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.
Reply With Quote
  #7  
Old 05-13-2014, 12:30 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 05-13-2014, 01:15 AM
laura66a laura66a is offline
 
Join Date: Oct 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is right from Facebook's documentation. It doesn't work.
Reply With Quote
  #9  
Old 05-13-2014, 02:10 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
Благодарность от:
Krusty1231
  #10  
Old 05-13-2014, 09:08 AM
laura66a laura66a is offline
 
Join Date: Oct 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:23 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05300 seconds
  • Memory Usage 2,258KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_html
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete