Rusty's Blog

Thoughts and musings of someone who's not sure what 'normal' is…

Monday, October 6, 2008

No hit count?

Since I started blogging with word pad, I have been somewhat currious as to how many times my page is being read. Surely I’m not the only one. Well, apparently as far as the WP people and community is concerned, it’s not all that important. So today I added a couple of functions to my users.php include to be used by my template’s footer.php file to display a rudimentary hit count. And when I say rudimentary, it’s pretty basic. No bouncing balls with the number, no per article counts, etc. All it does is display and update a bit of text you will see at the bottom of most of the pages here in my blog.

It’s not something I am going to advertise all that much. First of all the counter file is written into the function which means it is not easily re-configurable. It also means that it will probably be broken the next update I do to the blogging software. Variations on the theme include referencing a record in a database, keying off the story title in the requested URL to give article specific counters.

If I were doing this in python rather than php, I would probably just have one function. The process is open a file for read and write. read the content of the file. (which should be a number.) display the number. (which may include additional text wrapped around it, such as ‘Viewed :” “times.”) increment the number, and write it back into the file. I might be able to do that within php all as one function, but I figured that if I used an existing pair of functions, it would simplify things a bit. Additionally I can write a script at a later date to reference the write function and reset the counter to 0 at any time. Say perhaps any time I add a blog entry.

Well, time to get some cleaning and re-aranging done.

-Rusty

posted by Rusty at 1:46 pm  

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress