Very simple to implement.
Open:
Themes/default/Display.template.php
Find:
// Maybe they want to report this post to the moderator(s)?
Add before:
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 />';
};
Both versions?
Wow... i remember that if sentence for my first mod... :P
Quote from: DoctorMalboro on July 20, 2010, 10:04:15 PM
Both versions?
Wow... i remember that if sentence for my first mod... :P
What both versions? Nevermind. Yeah, RC3
where to put share image?
You don't need any image.
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.
nice job!
Great job! I have a quick question... is there anyway to code it to where it only shows on the first message on the first page?
Currently, it is showing on the first message of every page within a topic. I only want it to show on the very first post in the topic.
Thanks!
Good tip ;)
Lastnico's suggestion makes sense...
This code is for every first post in every page.
Is there any way to show only in first topics post (only for page 1)?
nice. thanks...
this is really a cool FAcebook share that I can also use.
Thanks 8) 8) 8)
Good tips thanks for sharing this it will help me a lot. Keep sharing! Thanks!
EDIT: Linked removed
Quote from: Dark-Wolf on September 13, 2010, 09:23:43 AM
This code is for every first post in every page.
Is there any way to show only in first topics post (only for page 1)?
Use this variable:
if ($message['id'] == $context['topic_first_message'])
BTW, this is for any version. I use it in 1.1.11
Thanks for share!
Quote from: Herr_Inoddorell on September 23, 2010, 10:28:49 PM
Use this variable:
if ($message['id'] == $context['topic_first_message'])
BTW, this is for any version. I use it in 1.1.11
Thanks for share!
Better than that:
global $topicinfo;
if ($message['id'] == $topicinfo['id_first_msg'])
;)
because if you use
"if ($message['id'] == $context['topic_first_message']) and you go to the second page... the button appears in the first post of that page :P
Quote from: lucas-ruroken on September 24, 2010, 01:13:31 AM
Quote from: Herr_Inoddorell on September 23, 2010, 10:28:49 PM
Use this variable:
if ($message['id'] == $context['topic_first_message'])
BTW, this is for any version. I use it in 1.1.11
Thanks for share!
Better than that:
global $topicinfo;
if ($message['id'] == $topicinfo['id_first_msg'])
;)
because if you use "if ($message['id'] == $context['topic_first_message']) and you go to the second page... the button appears in the first post of that page :P
Really? I tested it, but it didn't happen to me, it only shows on the very first message with $context['topic_first_message']).
[spanish mode on]qué raro es hablarte en inglés haha ;D[/spanish mode off]
yeah, the english is very hard to me :p
You need add the global $topicinfo.....
$context['topic_first_message']) is for the first message in every page... but $topicinfo['id_first_msg'] is for the first post.
Quote from: lucas-ruroken on September 25, 2010, 01:50:21 AM
yeah, the english is very hard to me :p
You need add the global $topicinfo.....
$context['topic_first_message']) is for the first message in every page... but $topicinfo['id_first_msg'] is for the first post.
Fine, but in my case it didn't happen that way, it only shows in the opening post of a topic, instead of the first post of a new page. It works for me at least :P, however, it's good to know another way, so I can learn much more :P.
of course 8) :P
Can i add this code to smf 2.0 ?
this code is for smf2 ;)
sorry, i meant the smf 2 RC2.
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?
I have added the code and the facebook shows as a title: An Error Has Occurred!
What is the code for "Share" button to appear on every 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 />';
what about smf1.1.13? :-[
Thanks it will really help me to track some traffic from facebook.. Keep sharing such informative and productive stuff.
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
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimageplay.net%2Fimg%2Fm7Gbd213098%2F2011_07_15_023536.jpg&hash=0e18f52fa7308d8866ff658a64786b6d6a45d12f)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimageplay.net%2Fimg%2Fm7Gbd213099%2F2011_07_15_023720.jpg&hash=6fe801ed768d0967a56549e145359bb895a39ad5)
It think it would be a helpful mod for ones who dont like to do manual changes.
it is easy tutorial trick! code!
Thank you so much information!
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
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimageplay.net%2Fimg%2Fm7Gbd213098%2F2011_07_15_023536.jpg&hash=0e18f52fa7308d8866ff658a64786b6d6a45d12f)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimageplay.net%2Fimg%2Fm7Gbd213099%2F2011_07_15_023720.jpg&hash=6fe801ed768d0967a56549e145359bb895a39ad5)
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?
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!
is that code working for current smf version? SMF 2.0.2.
Quote from: juliegreen on June 30, 2012, 09:00:11 AM
is that code working for current smf version? SMF 2.0.2.
Yes.
this is like the facebook "like" button? :-\
this is really a cool Facebook share this it will help me a lot. Keep sharing! Thanks!
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?
Thanks for the nice tips and I have tried it on my personal web page. It works.
good job. thank
Quote from: metalmaragato on July 15, 2011, 01:38:21 AM
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
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimageplay.net%2Fimg%2Fm7Gbd213098%2F2011_07_15_023536.jpg&hash=0e18f52fa7308d8866ff658a64786b6d6a45d12f)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimageplay.net%2Fimg%2Fm7Gbd213099%2F2011_07_15_023720.jpg&hash=6fe801ed768d0967a56549e145359bb895a39ad5)
Doesn't work for me, when i share facebook share button it doesn't pull the thread id. It ends up looking like this www.example.com/forums/index.php/null
Good Tips
Let's do it ^^ nice tutorial
How can we make it visible only to visitors?
It adds a lot to the load time if added to every post.
Very thank ;D
Nice tutorial thank you kha ;)
1- How can we make it visible only to visitors?
2- How can we add a logo to the share post? Right now It adds the title and part of the message but there is no logo.
3- Is there anyway to make the count box smaller?
4- How to make this button "Not appear" in some posts/boards ?
5-
Quote from: marci_n on July 22, 2011, 05:43:45 PM
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimageplay.net%2Fimg%2Fm7Gbd213099%2F2011_07_15_023720.jpg&hash=6fe801ed768d0967a56549e145359bb895a39ad5)
How come mine shows a very big count box? How can i remove the count?
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimageplay.net%2Fimg%2Ftya22293064%2FCapture.jpg&hash=fbc355fac05b01959ac5e9b3bbbffff15fd446ef)
Can anybody help me please?
ill add this to my plugin im making, hoping ill publish it soon :-\
Cool. Please let us know when done.
Hi,
Do you have any idea ho to change smf code to share topic on facebook not only as a text but text with pictures?
I have thise problem becouse if image is as a attachment I cant share topic with image :(
Best
Quote from: PLAYBOY on August 29, 2012, 01:24:59 AM
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?
i think someone made a mod
Quote from: Mick G. on November 26, 2012, 07:54:42 PM
Quote from: PLAYBOY on August 29, 2012, 01:24:59 AM
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?
i think someone made a mod
Can you give the link or the name of the mod?
unfortunately it's not working anymore. Facebook forcing us to use like instead share for some reasons.
Quote from: winsoft on November 28, 2012, 04:21:55 PM
unfortunately it's not working anymore. Facebook forcing us to use like instead share for some reasons.
It works on my site. FShare is pretty good. But it needs some repair and improvements.
I know there is something like
"Like button but when you click also a comment box popsup so you add a comment there too."
Can we make this current like button like that?