Adding a Twitter stream to Pligg

The hottest things online right now is social media, namely Digg style websites and Twitter.  With so many Digg style websites going up these days, it’s important to try and stand out from the pact and your niche.

Twitter streamingSo, why not put the power of Twitter to work for you?  A friend of mine suggested perhaps a Twitter stream in the sidebar.  This sounded great, but let’s make it even better.  I have one setup on FAQPAL, I decided to use as a reward for active members.  On FAQPAL, for each member that submits 3 tutorials their name is added, as long as the submissions are recent.

You can use whatever requirements you want, but you get the idea.  By using the method I have, this offers my users one more reason to submit, not only will the submission be promoted, but everything they tweet will also be promoted in my sidebar.

Here’s how to add it to your Pligg install:

Download and upload the following to your /js folder:

  Twitter Stream JS (6.4 KiB, 172 hits)

Open pligg.tpl, locate /body and add the following before:

{literal}
<script type="text/javascript"><!–
  var rpnetTwitAttrs = {
    usernames: "Pliggs,Grafpedia,dennysugar,bkmacdaddy",
    count: 5,
    title: "Twitter Stream",
    showImages: true,
    imageHeight: ‘48px’,
    imageWidth: ‘48px’
  };
// –></script>
<script type="text/javascript" src="http://www.domain.com/js/TwitterWidget.js">
</script>
{/literal}

make sure you change the domain.com to whatever your url is.  The values for “username” can be changed to whatever Twitter id’s you want to display.

Open sidebar.tpl and add the following line where you want the stream to appear:

{if $pagename neq "story"}{assign var=sidebar_module value="twitterstream"}{include file=$the_template_sidebar_modules."/wrapper.tpl"}{/if}

Save and close.

Now, create a file called twitterstream.tpl and add the following to it:

<div class="tlb">
        <a id="rpnet_twTitle" href="#">Twitter Stream</a></div>
<div id="rpnet_twitterWidget">

Get your username listed here by <a title="Submit a tutorial" href="http://www.domain.com/submit">submitting tutorials</a></div>

Again, be sure to change domain.com to whatever your url is.

Save and upload to your sidebar_modules directory.

That’s it.

Notes:

Because of Twitter’s API limitations on the number of API calls in one hour, the stream may appear blank after a while, depending on the traffic to your site, if it does, you will need to wait until the hour is up.  I am hoping to have a cache feature added it to soon to prevent time outs.

The original idea came from our friends at Ronak Patel

If you haven’t added us on Twitter, you can find us at @Pliggs

If you enjoyed this post, make sure you subscribe to my RSS feed!

  • You use a lot of good imagery in this piece, however, sometimes you overuse descriptive, complex vocabulary. It's an excellent piece though but it could do with more variety. If you alter the mood you'll be able to engage the reader more easily.
  • Though I do think it's pretty interesting to follow your favorite artists who post updates about their work on their album or they let you know when they're going on tour, especially "less-known" celebrities.
  • and I am using it!!
  • For twitter user must use that. thanks I use your code.
  • this is a good idea if you want to promote your website in social networking websites.
  • Social media sites now very popular. Thanks for information about it digg style website.
  • Do you share a very useful article. learned thanks to you
  • Twitter stream looks good. It's easy just copy this code and paste it.
  • do i have to put pligg.tpl code right after </head> tag or before <body> tag, if i am not mistaken. waiting for your clarification
  • Put it just before the closing body tag
blog comments powered by Disqus