Customizing SMF > Tips and Tricks

[TIP] Facebook Share Button

<< < (2/12) > >>

lastnico:
If you can, try to split up the thing in two parts:

Themes/default/Display.template.php

--- Code: ---                      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 />';
                            };

--- End code ---

And put this in the footer

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

--- End code ---

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

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

jekwumoore:
nice job!

rngrdanny22:
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!

lucas-ruroken:
Good tip ;)

Kcmartz:
Lastnico's suggestion makes sense...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version