12-05-2010, 06:51 AM
[TUT] Adding a twitter button to your forum
This is a tutorial on how to add a twitter / tweet button to the postbit, this means that it'll appear at the bottom of every post including the initial one.
We will be editing two template files.
Note: Any member that wishes to tweet must have their own twitter account.
Steps
1) Go to http://twitter.com/goodies/tweetbutton and select the tweet button that you would like to use.
I went with "No count".
The button looks like this:
The HTML looks like this:
2) Log into your forum and go to
Admin CP > Templates & Style > Templates > *your template* > Post Bit Templates > postbit
Find:
and add
to the end so it looks like
Save the template.
3) Now, go to Admin CP > Templates & Style > Templates > *your template* > Post Bit Templates > Add Template
Template name: postbit_twitter
Mine looks like this
Save the template.
4) Download and open the file
And add the following
Save and re-upload the file, replacing the old one.
Further Explanation
So you've finished or.. you want to know what it looks like before you start changing things.
Live demo: http://mcompute.co.uk
postbit view
pop out view (When the button is pressed)
End result, what it looks like on twitter.
Original tutorial: http://mcompute.co.uk/showthread.php?tid=616
This is a tutorial on how to add a twitter / tweet button to the postbit, this means that it'll appear at the bottom of every post including the initial one.
We will be editing two template files.
Note: Any member that wishes to tweet must have their own twitter account.
Steps
1) Go to http://twitter.com/goodies/tweetbutton and select the tweet button that you would like to use.
I went with "No count".
The button looks like this:
The HTML looks like this:
Code:
<a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="mcomputeforums">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
2) Log into your forum and go to
Admin CP > Templates & Style > Templates > *your template* > Post Bit Templates > postbit
Find:
Code:
{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_rep']}
and add
Code:
{$post['button_twitter']}
to the end so it looks like
Code:
{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_rep']}{$post['button_twitter']}
Save the template.
3) Now, go to Admin CP > Templates & Style > Templates > *your template* > Post Bit Templates > Add Template
Template name: postbit_twitter
Mine looks like this
Code:
<a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="mcomputeforums">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
4) Download and open the file
Code:
inc/functions_post.php
And add the following
PHP Code:
eval("\$post['button_twitter'] = \"".$templates->get("postbit_twitter")."\";");
Save and re-upload the file, replacing the old one.
Further Explanation
So you've finished or.. you want to know what it looks like before you start changing things.
Live demo: http://mcompute.co.uk
postbit view
pop out view (When the button is pressed)
End result, what it looks like on twitter.
Original tutorial: http://mcompute.co.uk/showthread.php?tid=616