Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

PANEL SNIPPIT:: Twitter Followers Panel

Twitter Followers Panel

Preview:
www.phpfusionmods.co.uk/images/twitfollowpreview.png

This panel will display your Twitter Followers, just enter your Twitter Username where it is commented in the code below.

Upload this image to /images/
www.phpfusionmods.co.uk/images/twittiny.png

Go to Admin >>> System >>> Panels >>> Add a new Side Panel

Paste in the code, save and enable.

CodeDownload  

/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2013 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Name: Twitter Followers Panel
| Version: 1.00
| Author: PHP-Fusion Mods UK
| Developer: Craig
| Site: http://www.phpfusionmods.co.uk
| Thanks Twitter API
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

// Your Twitter Username
   $twitter_username ="fangree";

// Gets Your Twitter Followers
function getTwitFollowers($username) {
   $api = "http://api.twitter.com/1/statuses/user_timeline.json?count=1&screen_name=" . $username;
   $res = json_decode(file_get_contents($api), true);
   return $res[0]["user"]["followers_count"];
}

// The Styles For the div, span and image classes
add_to_head("<style type='text/css'>

.pfmuk_twit-followers {
   margin-left: auto;
   margin-right: auto;
   background: #1AB2E8;
   font-family: Helvetica Neue,Arial,sans-serif;
   font-size: 11px;
   font-weight: bold;
   min-width:200px;
   max-width: 250px;
   padding: 5px;
   border-radius : 5px;
   -moz-border-radius : 5px;
   -webkit-border-radius : 5px;
}

.pfmuk_twit_span {
   color: #eee;
}

.pfmuk_twit_img {
   padding-bottom: 1px;
   vertical-align: middle;
   border: 0px;
}

</style>");

// The Twitter Followers Panel
openside("Twitter Followers");
   echo"<div class='pfmuk_twit-followers'> ";
   echo "<span class='pfmuk_twit_span'>@".$twitter_username."</span> has <span class='pfmuk_twit_span'>".getTwitFollowers($twitter_username)."</span> Followers on<img src='".IMAGES."twittiny.png' alt='Twitter Followers' class='pfmuk_twit_img' /></div>\n";
closeside();

nice!
Thread Information
Author
Replies
2 posts
Views
1,924 times
Last Post
Last updated on 7 years ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Craig, jikaka