php forum
php mysql forum
php mysql smarty
 
Topic Options
#317550 - 09/10/08 06:44 PM Topic Views Help
FREAK1 Offline
User

Registered: 07/01/03
Posts: 46
Hi guys,

Rick suggested I put a request here so I can get a problem fixed.

Just to make it easy here is the topic...

http://www.ubbcentral.com/forums/ubbthreads.php/topics/216481/Topic_Views.html#Post216481

In a nutshell I want topic views to increase every time someone clicks on a topic, whether it be the same person looking at the information twice or two different people.

I hope this makes sense, if not please let me know.

Thanks in advance.

Top
#317552 - 09/11/08 02:28 AM Re: Topic Views Help [Re: FREAK1]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
Do you also want it to count if they go to a 2nd page from a topic?

That's a bit a of the problem if you really want to count every click, and not every new visit to the topic.
_________________________

Top
#317553 - 09/11/08 06:54 PM Re: Topic Views Help [Re: blaaskaak]
FREAK1 Offline
User

Registered: 07/01/03
Posts: 46
I don't think a click to a 2nd page is necessary. I have members that will come to the board, leave and come back. I don't care if they do it 20 times, but I want it to count as 20 topic hits. Instead of 1 because they didn't clear a cookie.

I hope that makes sense and thanks for the reply.

Top
#317554 - 09/12/08 02:49 AM Re: Topic Views Help [Re: FREAK1]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
It actually makes it more difficult. You would need some mechanism that tracks if you just clicked to a new page in the topic, or visit the topic fresh.

I am thinking about the referrer variable to check for that.

You are running 7.1.1 and using spider friendly url's right?


Edited by blaaskaak (09/12/08 02:50 AM)
_________________________

Top
#317560 - 09/12/08 07:55 PM Re: Topic Views Help [Re: blaaskaak]
FREAK1 Offline
User

Registered: 07/01/03
Posts: 46
If it makes it easier to count as a view by clicking to a 2nd or 3rd page that's fine.

I am using 7.1.1. and spider friendly. They like to visit the site.

Top
#317564 - 09/13/08 11:40 PM Re: Topic Views Help [Re: FREAK1]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
ok. I'll do this coming wednesday, I have a day off then.
_________________________

Top
#317571 - 09/16/08 06:43 PM Re: Topic Views Help [Re: blaaskaak]
FREAK1 Offline
User

Registered: 07/01/03
Posts: 46
Blaaskaak thank you for doing this. smile It is greatly appreciated.

Top
#317573 - 09/18/08 01:15 AM Re: Topic Views Help [Re: FREAK1]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
You need to modify 2 files:


find:

/scripts/showthreaded.inc.php

Php Code:
 if ($_SESSION['current_topic'] != $main_topic_id) {
		$query = "
			insert into {$config['TABLE_PREFIX']}TOPIC_VIEWS
			(TOPIC_ID)
			values
			( ? )
		";
		$dbh -> do_placeholder_query($query,array($main_topic_id),__LINE__,__FILE__);
		$_SESSION['current_topic'] = $main_topic_id;
	}
 


Replace with:

Php Code:
//	if ($_SESSION['current_topic'] != $main_topic_id) {
		$query = "
			insert into {$config['TABLE_PREFIX']}TOPIC_VIEWS
			(TOPIC_ID)
			values
			( ? )
		";
		$dbh -> do_placeholder_query($query,array($main_topic_id),__LINE__,__FILE__);
		$_SESSION['current_topic'] = $main_topic_id;
//	}
 




/scripts/showflat.inc.php

Php Code:
 if ($_SESSION['current_topic'] != $current) {
		$query = "
			insert into {$config['TABLE_PREFIX']}TOPIC_VIEWS
			(TOPIC_ID)
			values
			( ? )
		";
		$dbh -> do_placeholder_query($query,array($current),__LINE__,__FILE__);
		$_SESSION['current_topic'] = $current;
	}
 


Replace with:

Php Code:
//	if ($_SESSION['current_topic'] != $current) {
		$query = "
			insert into {$config['TABLE_PREFIX']}TOPIC_VIEWS
			(TOPIC_ID)
			values
			( ? )
		";
		$dbh -> do_placeholder_query($query,array($current),__LINE__,__FILE__);
		$_SESSION['current_topic'] = $current;
//	}
 
_________________________

Top
#317574 - 09/18/08 01:22 AM Re: Topic Views Help [Re: blaaskaak]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
Hm, I would skip that hack for viewthreaded.php... Every message you read is a click. I don't know if you disabled threaded view, but if you didn't, I would stick with the default behavior of the script.

Please mind that it will still cache the view counter, it won't be updated until a post is made.

edit: I just saw the thread on ubbcentral, and it's the same as Rick suggested there. Don't know why it would stop with counting all together, I've tested it, and it works.


Edited by blaaskaak (09/18/08 01:56 AM)
_________________________

Top
#317576 - 09/18/08 06:29 PM Re: Topic Views Help [Re: blaaskaak]
FREAK1 Offline
User

Registered: 07/01/03
Posts: 46
blaaskaak thanks, I haven't done anything yet. I have to find where these items are located to make the changes.

Just so I am perfectly clear, am I still doing both of them or just one. If one, is it the top or the bottom one.

Please advise as I am going to attempt to do this tomorrow evening if I can find what you are telling me to change.

Thanks again for all of your help.

Top
#317577 - 09/19/08 01:46 AM Re: Topic Views Help [Re: FREAK1]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
/yourforum/scripts/showthreads.inc.php

that's the one you want to change. But it is the same change Rick asked you to do.
_________________________

Top
#317578 - 09/19/08 05:09 PM Re: Topic Views Help [Re: blaaskaak]
FREAK1 Offline
User

Registered: 07/01/03
Posts: 46
Ok now I am lost !!! So now do none of them?

Top
#317579 - 09/20/08 05:18 AM Re: Topic Views Help [Re: FREAK1]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
well, do the one for showflat.inc.php
_________________________

Top
#317582 - 09/21/08 08:04 PM Re: Topic Views Help [Re: blaaskaak]
FREAK1 Offline
User

Registered: 07/01/03
Posts: 46
I did the top one.. Seems to have worked because the views are up. smile

Top



Moderator:  sirdude 
Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks