Post Views Widget Based On Yearly Hits For Blogger

Post Views Widget Based On Yearly Hits For Blogger, here is the last page counter widget that you wanna have. However, if you want to have page counter widgets to show the past views of your blog, like yesterday or last month views for example, i can also create those all for you, but i won't create any post for those, you have to ask me for that.

Let's get straight down to bussiness, i have published a lot of kind of page counter widget before, head to those if you want to know anything about page counter widget. Below are the links:

Individual Page Counter
Page Counter Based On Daily Views
Page Counter Based On Weekly Views
Page Counter Based On Monthly Views
Total & Unique Page Counter
Creating Table For Counter Widget
Web Hosting With PHP And MySQL Support

Go to the first link of the above for complete tutorial about creating page counter widget. You know i'm not going to explain how to execute the code i'd like to give here, read the post about daily page counter widget for the exact pattern for this yearly page counter.

How To Create Page Counter Widget Based On Yearly Views For Blogger

1. Create a new text file and simply fill it with a single number, 0.
2. Go to file manager of your php hosting and upload the file.
3. Chmod the file to 777.
4. Copypass the following code and upload to your hosting.

<?php
$save = "yearly-stats.txt"; $open = fopen($save, "a+"); $file = filesize($save); $date = date("D/M/y"); $year = date("y");
if ($file==0) { $counter = 1; fwrite($open, $date."/".$counter); }
else { $read = fread($open, $file); $data = explode("/", $read); ftruncate($open, 0);
if($year == $data[2]) { $counter = $data[3]+1; fwrite($open, $date."/".$counter); }
else { $counter = 1; fwrite($open, $date."/".$counter); }
}
echo "document.write($counter);";
fclose($open);
?>

Here to copy


5. Take the url of the page you published and cover it with javascript to call from your website.

Well done!

0 comments:

Post a Comment