WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You

WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1Rejected Twitter Count [PHP] Thu Jul 01, 2010 12:03 am

RockerMan

RockerMan
Technician
Technician
Twitter Followers Widget
Twitter Count [PHP] Comp12

This is a cool little widget that you can use to count your twitter followers, just follow me and you can't go wrong Wink

Lets get started with the PHP...
Code:
<?php
$tw = get_option("twitterfollowerscount");
if ($tw['lastcheck'] < ( mktime() - 3600 ) )
{
$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name=YOUR-FEED');
if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) {
$tw['count'] = $match[1];
}
$tw['lastcheck'] = mktime();
update_option("twitterfollowerscount",$tw);
}
echo $tw['count'];
?>

OK so you looking at the code and thinking what the ****, here is a simple explanation Razz

The first couple of lines grab the twitter count, notice the “mktime 3600″. This means the twitter count will get called every 3600 seconds or every hour instead of calling it on every page load

The next couple of lines is your twitter feed
Code:
$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name=YOUR-FEED');

Where you see YOUR-FEED replace it with your feed, here is an example:
Code:
$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name=RockerMan');

OK so now save your file as twitter.php and place it into your website directory.

Now inside your templates place this code where you would like to display the widget:
Code:
<?php include("twitter.php"); ?>

You can easily change the way it looks by using CSS, here is an example.

HTML:
Code:
<p><span class="twitter-followers"><?php include("twitter.php"); ?></span> Followers</p>

CSS:
Code:

p{
color:#fff;
}

span.twitter-followers {
font-size: 24px;
vertical-align: middle;
padding-left: 5px;
color: #1e96db;
}

Hope you enjoy!
RockerMan

http://www.graphics-post.com/

2Rejected Re: Twitter Count [PHP] Thu Jul 01, 2010 12:19 am

Nem

Nem
Registered Member
Registered Member
Nice tutorial Very Happy
Twitter Count [PHP] Signem14

http://www.graphics-post.com/forum

3Rejected Re: Twitter Count [PHP] Thu Jul 01, 2010 12:23 am

RockerMan

RockerMan
Technician
Technician
Thank you Smile

http://www.graphics-post.com/

4Rejected Re: Twitter Count [PHP] Thu Jul 01, 2010 12:57 am

Fred100

Fred100
Registered Member
Registered Member
I'd love to see a demo/preview of how it looks ,
And I personally found your
OK so you looking at the code and thinking what the ****, here is a simple explanation Razz
this post , pretty aggressive Razz

http://www.art-castle.biz/forum.htm

5Rejected Re: Twitter Count [PHP] Thu Jul 01, 2010 1:26 am

RockerMan

RockerMan
Technician
Technician
Unfortunatly, I am still in the middle of designing my website. I am getting my hosting sometime soon, then I will be posting demos etc... Smile

These are just some things that I know from today at uni Smile

http://www.graphics-post.com/

6Rejected Re: Twitter Count [PHP] Thu Jul 01, 2010 1:38 am

Fred100

Fred100
Registered Member
Registered Member
Well , you can always make a test forum , and try it out there , and show it to others Smile

http://www.art-castle.biz/forum.htm

7Rejected Re: Twitter Count [PHP] Thu Jul 01, 2010 2:39 am

RockerMan

RockerMan
Technician
Technician
A test forum?

Every free forum hosting I have checked does not support PHP and I have not got a premium acount with BraveHost. I am getting hosting very soon Smile

If I can I will upload it to the Uni's FTP but don't hold me on it Smile

http://www.graphics-post.com/

8Rejected Re: Twitter Count [PHP] Fri Jul 02, 2010 2:40 am

RockerMan

RockerMan
Technician
Technician
OK, so I tried to upload it to the uni's FTP but I got caught. Lol

If anyone has any ideas or would like to host it for me please speak up Smile

http://www.graphics-post.com/

9Rejected Re: Twitter Count [PHP] Fri Jul 02, 2010 1:49 pm

ankillien

ankillien
Administrator
Administrator
RockerMan wrote:OK, so I tried to upload it to the uni's FTP but I got caught. Lol

If anyone has any ideas or would like to host it for me please speak up Smile

You can get a free web host that provides PHP. Many free hosts provide PHP and databases.

10Rejected Re: Twitter Count [PHP] Sat Jul 03, 2010 12:30 am

RockerMan

RockerMan
Technician
Technician
Yes but most of them don't provide direct linking unless you have a premium account Axe

http://www.graphics-post.com/

11Rejected Re: Twitter Count [PHP] Sat Jul 17, 2010 3:09 am

RockerMan

RockerMan
Technician
Technician
Any news on this been accepted or declined Razz

http://www.graphics-post.com/

12Rejected Re: Twitter Count [PHP] Sat Jul 17, 2010 8:24 am

ankillien

ankillien
Administrator
Administrator
The tutorial is good so I haven't rejected it Razz but it would be better if you can show a demo.

If you manage to put a demo of this tut somewhere, I'll accept it right away Very Happy

13Rejected Re: Twitter Count [PHP] Sat Jul 17, 2010 4:23 pm

RockerMan

RockerMan
Technician
Technician
Okidoke, I will try to get a demo up sometime today...

http://www.graphics-post.com/

14Rejected Re: Twitter Count [PHP] Sat Jul 24, 2010 10:16 pm

RockerMan

RockerMan
Technician
Technician
You can reject this as it is not working for some strange reason Evil or Very Mad

I will PM you when I get it working Wink

http://www.graphics-post.com/

15Rejected Re: Twitter Count [PHP] Sat Jul 24, 2010 11:03 pm

ankillien

ankillien
Administrator
Administrator
Ok...as you wish Very Happy

Rejected

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum