News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

[TIP] Facebook Share Button

Started by Mick., July 20, 2010, 01:24:31 PM

Previous topic - Next topic

searchgr


lucas-ruroken

Adk Portal 3.1 is coming....

Design your universe!

searchgr


lucas-ruroken

Adk Portal 3.1 is coming....

Design your universe!

searchgr

Quote from: lastnico on August 16, 2010, 10:11:46 AM
If you can, try to split up the thing in two parts:

Themes/default/Display.template.php

                      if ($message['id'] == $context['first_message']) {
                            echo '<br /><br /><a name="fb_share" type="box_count" href="http://www.facebook.com/sharer.php">Share</a><br /><br />';
                            };


And put this in the footer

              echo '<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>';


It will increase page loading speed time (a little bit).

See http://developer.yahoo.com/performance/rules.html#js_bottom for more info.

Where in the footer? Can you specify please?

searchgr

I have added the code and the facebook shows as a title: An Error Has Occurred!

Diomet

What is the code for "Share" button to appear on every message?
SMF 2.0 RC3
My SMF Forum [nofollow]

Masterd

                            echo '<br /><br /><a name="fb_share" type="box_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script><br /><br />';

kavasa


sunehrigal

Thanks it will really help me to track some traffic from facebook.. Keep sharing such informative and productive stuff.

metalmaragato

#30
it work for SMF 1.1.14 and work fine with the Google +1 Topics MOD

Google +1 Topics code

// Start Google +1 Mod smfhacks.com
if ($message['id'] == $context['topic_first_message'] )
{
echo '<div style="float: left"><g:plusone href="' . $scripturl . '?topic=' . $context['current_topic'] . '" size="small"></g:plusone>
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script></div>';
}
// End Google Plus +1 Mod smfhacks.com


This tip with some changes change the button for button_count

// Start Facebook share
if ($message['id'] == $context['topic_first_message'] )
{
        echo '<div style="float: left"><a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script></div>';
                            }
// End Facebook share





PLAYBOY

It think it would be a helpful mod for ones who dont like to do manual changes.

~Dragon~

it is easy tutorial trick! code!

Thank you so much information!
Please do not PM or email, Thank respond please post fast to SMF!

marci_n

Quote from: metalmaragato on July 15, 2011, 01:38:21 AM

This tip with some changes change the button for button_count

// Start Facebook share
if ($message['id'] == $context['topic_first_message'] )
{
        echo '<div style="float: left"><a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script></div>';
                            }
// End Facebook share







It's working but... when I click on share button facebook doesn't have the forum default thumbnails. Ive got "Choose a thumbnail" on the windows popup and there is forum logo but also avatars from users profile discussing in that shared topics. Any idea?

8hoursale

I know this is an old topic, but hopefully someone can help me. I just tired to copy this this code:

if ($message['id'] == $context['topic_first_message'])
                            echo '<br /><br /><a name="fb_share" type="box_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script><br /><br />';};


and put it right before:

// Maybe they want to report this post to the moderator(s)?

received an error that said.

The file you tried to save generated the following error:
Parse error: syntax error, unexpected '}' in Display.template.php on line 676


I'm using SMF 1.1

I'd appreciate any help.

Thanks!

juliegreen

is that code working for current smf version? SMF 2.0.2.

Mick.


gerzok

this is like the facebook "like" button?  :-\

goldysaini

 this is really a cool Facebook share this it will help me a lot. Keep sharing! Thanks!

PLAYBOY

Quote from: PLAYBOY on July 15, 2011, 01:43:39 AM
It think it would be a helpful mod for ones who dont like to do manual changes.

There is still not a mod to do this right?

Advertisement: