Advertisement:

Author Topic: [TIP] Facebook Share Button  (Read 56839 times)

Offline Mick.

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,673
  • Gender: Male
  • Premium SMF Themes
    • idesign360 on Facebook
    • @idesign360 on Twitter
[TIP] Facebook Share Button
« on: July 20, 2010, 01:24:31 PM »
Very simple to implement.

Open:
Themes/default/Display.template.php

Find:
Code: [Select]
// Maybe they want to report this post to the moderator(s)?
Add before:
Code: [Select]
                      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 />';
                            };
« Last Edit: December 04, 2010, 12:39:31 PM by bluedevil »

Offline DoctorMalboro

  • SMF Hero
  • ******
  • Posts: 9,084
  • Gender: Male
  • うまいいいいいい!!!!!
    • @DoctorMalboro on Twitter
    • Personal website
Re: [TIP] Facebook Share Button
« Reply #1 on: July 20, 2010, 10:04:15 PM »
Both versions?

Wow... i remember that if sentence for my first mod... :P

Offline Mick.

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,673
  • Gender: Male
  • Premium SMF Themes
    • idesign360 on Facebook
    • @idesign360 on Twitter
Re: [TIP] Facebook Share Button
« Reply #2 on: July 20, 2010, 10:44:12 PM »
Both versions?

Wow... i remember that if sentence for my first mod... :P

What both versions?  Nevermind.    Yeah, RC3

Offline rakicko

  • Full Member
  • ***
  • Posts: 418
  • Gender: Male
  • Have fun!
    • http://
Re: [TIP] Facebook Share Button
« Reply #3 on: August 13, 2010, 07:42:05 PM »
where to put share image?

Offline Masterd

  • SMF Hero
  • ******
  • Posts: 3,887
  • Gender: Male
  • Sapienti satis.
Re: [TIP] Facebook Share Button
« Reply #4 on: August 14, 2010, 02:09:45 PM »
You don't need any image.
My Mods

Sugested that too. Hey ho. I'd link you to the original discussion but it's not visible to most people (seekrit team board stuff that is more dangerous than wikileaks).


Don't PM me for support! Use the appropriate support board!

Offline lastnico

  • Semi-Newbie
  • *
  • Posts: 45
  • Gender: Male
    • Forum Software Reviews
Re: [TIP] Facebook Share Button
« Reply #5 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
Code: [Select]
                      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
Code: [Select]
              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.

Offline jekwumoore

  • Semi-Newbie
  • *
  • Posts: 53
Re: [TIP] Facebook Share Button
« Reply #6 on: August 22, 2010, 12:37:16 PM »
nice job!
we rule the world

Offline rngrdanny22

  • Jr. Member
  • **
  • Posts: 214
    • NookForum.com
Re: [TIP] Facebook Share Button
« Reply #7 on: August 30, 2010, 01:13:54 PM »
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!

Offline lucas-ruroken

  • SMF Hero
  • ******
  • Posts: 4,907
  • Gender: Male
  • Adk Developer
    • lucas.ruroken on Facebook
    • lucasruroken on GitHub
Re: [TIP] Facebook Share Button
« Reply #8 on: August 31, 2010, 12:52:34 PM »
Good tip ;)
Adk Portal 3.1 is coming....

Design your universe!

Offline KensonPlays

  • SMF Hero
  • ******
  • Posts: 4,297
Re: [TIP] Facebook Share Button
« Reply #9 on: September 06, 2010, 03:12:28 AM »
Lastnico's suggestion makes sense...

Offline L'AltroWeb

  • Jr. Member
  • **
  • Posts: 344
  • Gender: Male
  • L'AltroWeb
    • laltroweb on Facebook
    • @laltroweb on Twitter
    • L'AltroWeb
Re: [TIP] Facebook Share Button
« Reply #10 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)?

Offline Dharshan

  • Full Member
  • ***
  • Posts: 423
  • Gender: Male
  • Free as wind!
    • pcguide
Re: [TIP] Facebook Share Button
« Reply #11 on: September 13, 2010, 09:57:59 AM »
nice. thanks...
R I P  : Steve Jobs | you made the world today look how it is | Thank you

Offline wcharlot

  • Semi-Newbie
  • *
  • Posts: 87
    • Grow Taller
Re: [TIP] Facebook Share Button
« Reply #12 on: September 14, 2010, 12:24:41 AM »
this is really a cool FAcebook share that I can also use.

Thanks  8) 8) 8)

Offline SEOAUS

  • Newbie
  • *
  • Posts: 1
Re: [TIP] Facebook Share Button
« Reply #13 on: September 15, 2010, 01:24:56 AM »
Good tips thanks for sharing this it will help me a lot. Keep sharing! Thanks!

EDIT: Linked removed
« Last Edit: October 01, 2010, 04:15:44 AM by ѕησω »

Offline Herr_Inoddorell

  • Jr. Member
  • **
  • Posts: 311
    • Blind Guardian Argentina
Re: [TIP] Facebook Share Button
« Reply #14 on: September 23, 2010, 10:28:49 PM »
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!

Offline lucas-ruroken

  • SMF Hero
  • ******
  • Posts: 4,907
  • Gender: Male
  • Adk Developer
    • lucas.ruroken on Facebook
    • lucasruroken on GitHub
Re: [TIP] Facebook Share Button
« Reply #15 on: September 24, 2010, 01:13:31 AM »
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
Adk Portal 3.1 is coming....

Design your universe!

Offline Herr_Inoddorell

  • Jr. Member
  • **
  • Posts: 311
    • Blind Guardian Argentina
Re: [TIP] Facebook Share Button
« Reply #16 on: September 24, 2010, 05:32:53 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]

Offline lucas-ruroken

  • SMF Hero
  • ******
  • Posts: 4,907
  • Gender: Male
  • Adk Developer
    • lucas.ruroken on Facebook
    • lucasruroken on GitHub
Re: [TIP] Facebook Share Button
« Reply #17 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.


Adk Portal 3.1 is coming....

Design your universe!

Offline Herr_Inoddorell

  • Jr. Member
  • **
  • Posts: 311
    • Blind Guardian Argentina
Re: [TIP] Facebook Share Button
« Reply #18 on: September 25, 2010, 07:45:40 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.

Offline lucas-ruroken

  • SMF Hero
  • ******
  • Posts: 4,907
  • Gender: Male
  • Adk Developer
    • lucas.ruroken on Facebook
    • lucasruroken on GitHub
Re: [TIP] Facebook Share Button
« Reply #19 on: September 25, 2010, 12:17:09 PM »
of course 8) :P
Adk Portal 3.1 is coming....

Design your universe!