Page 1 of 1

Timestamp and counter integration. *Request*

Posted: Tue Feb 07, 2006 9:08 pm
by Debikul
Script URL:
Version of script:
Version of PHP:
Hosting company:
Have you searched THIS FORUM for your problem:
(if not please do before posting)
If so, what terms did you try:

Write your message below:

Hello,

I was wondering if there was a way to integrate a hit counter per topic on the board, along with a timestamp to include the time in addition to the date. If anyone could help me with this I would greatly appreciate it.

Posted: Thu Feb 09, 2006 7:54 am
by Debikul
Ok, I figured out how to add the time posted but I have no idea who to go about showing how many times a post has been viewed. Can anyone help me out here?

Anyway, to add the time beside the date of a post look for the following code in the mbaord.php file:

Code: Select all

$date=date ("d/M/Y");
and replace with:

Code: Select all

$date=date ("d/M/Y g:i a");
I'm sure someone will be able to find this useful if they are new to php and are just learning.

Anyway, does anyone have any idea how to add a "message viewed 'x' amount of times" to the forum script?

Posted: Thu Feb 09, 2006 9:28 am
by Klemen
Hi,

Glad to hear you got the first one going, all it takes is a little effort and I always prefer helping people who show effort :wink:

As for the second one, you should use some hit counter, like the one at
http://www.phpjunkyard.com/php-text-hit-counter.php

Then edit mboard.php - line 338 should be empty, you can simply paste something like this there:

Code: Select all

$content.='<p align="center">Message viewed <script language="Javascript"
src="http://www.yourdomain.com/path_to_counter/counter.php?page='.$count.'"></script> times</p>';
Of course replace the URL of counter.php with your own. You could also use any other counter script similarly.

Just a note - this will add the counter to new posts, but not existing ones.

Regards

Posted: Thu Feb 09, 2006 9:45 pm
by Debikul
That sounds excellent! Thank you a million times!

I seriously had no idea how to integrate something like that and failed trying to do it. But many thanks again!

Oh, sorry about the edit.

I was wondering how it would be possible to put the "message viewed" out beside the date and time portion of the forum to show how many clicks it has. I did see where it showed how many clicks it has once you clicked on the subject, but I was wondering if I could put it on the frontpage beside the topic listing with the time, date, etc?

Posted: Thu Feb 09, 2006 10:20 pm
by Klemen
That's more work and would require quite some editing and coding and probably also complications (it's easy to do such things with MySQL database, but text databases have their limits).

Regards

Posted: Sun May 07, 2006 12:12 am
by zr
I created an add on that I think meets your criteria.

Go to viewtopic.php?t=822

Hope this helps! :D