Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 MOD request : Different read stats.
 New Topic  Reply to Topic
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 3

pitstraight
New Member

Australia
82 Posts

Posted - 03 February 2008 :  19:10:57  Show Profile  Reply with Quote
Anyone ?<
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 04 February 2008 :  01:31:58  Show Profile  Visit muzishun's Homepage  Reply with Quote
See my suggestion above. It wouldn't make a difference whether the feature was only available to you or everybody on your forum, as the bloat is on the database side of the equation rather than the user side. However, the concept is certainly plausible, and the method I described above should work to do what you're wanting.<

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 04 February 2008 :  08:57:30  Show Profile  Reply with Quote
one of these could probably be tweeked to do what you want.
Kal Corp
http://forum.snitz.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=33102&SearchTerms=who+viewed

and Nikkols
http://forum.snitz.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=43287&SearchTerms=who+viewed

Kal Corps mod, minus the memberid row, has the db table you need.

I've never looked at Nikkols mod.

I'll look at modifying Kals later on today.

<

    _-/Cripto9t\-_
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 04 February 2008 :  09:03:41  Show Profile  Visit AnonJr's Homepage  Reply with Quote
quote:
Originally posted by muzishun

If you want to go that route, here's how I would do it: create a new table, TOPIC_VIEWS, and store all of the information there. For fields, I'd have something like VIEW_ID (just so there is a unique key), TOPIC_ID, and VIEW_TIME.

Then you could query the table as you wanted to get results for different time frames. It adds some overhead to the forum, but I suppose the tradeoff depends on how busy your forum is or how beefy your server. As AnonJr mentioned, this table will bloat your DB in a hurry, since every time someone reads a topic (thousands of times a day on forums like this one), there's an associated DB entry.



I'll ditto that. Its pretty much the same thing I was thinking of. I had intended on putting something quick together this weekend, but things got busy... <
Go to Top of Page

pitstraight
New Member

Australia
82 Posts

Posted - 05 February 2008 :  22:46:05  Show Profile  Reply with Quote
cripto9t, how are you going with it ? I've had a quick look at those links that you posted but they don't make a lot of sense to me. I'm not a code monkey by any stretch.<
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 06 February 2008 :  02:06:40  Show Profile  Visit muzishun's Homepage  Reply with Quote
I'll make the same tentative offer as the other thread. If I wind up having tomorrow off due to the snowstorm, I will try and write something up for this.<

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 06 February 2008 :  10:17:40  Show Profile  Reply with Quote
I've got the basics working. I decided to update the records by the day. It will cut down on the entries a bit.

This is the db setup I have so far
        case "mysql"

               strSql = "CREATE TABLE " & strTablePrefix & "TOPIC_VIEWS ( "
	        strSql = strSql & "TOPICVIEW_ID int NOT NULL auto_increment, "
	        strSql = strSql & "TV_TOPIC_ID INT DEFAULT '1' NOT NULL, "
                strSql = strSql & "TV_VIEWS INT DEFAULT '0' NOT NULL, "
	        strSql = strSql & "TV_DATE varchar (14) DEFAULT '' NOT NULL, "
                strSql = strSql & "PRIMARY KEY (TV_TOPIC_ID), "
                strSql = strSql & "KEY " & strTablePrefix & "TOPIC_VIEWS_TOPICVIEW_ID(TOPICVIEW_ID))"

	        my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

I might drop the identity column because, right now, I don't see no need for it. I also plan to knock the date down to 8 characters to store just (year,month,day), because the time is irrelevent.

Heres the code in topic.asp to update the counts.
        iDate = Left(DateToStr(strForumTimeAdjust),8)

	strSql = "SELECT TV_TOPIC_ID FROM " & strTablePrefix & "TOPIC_VIEWS " &_
		 " WHERE TV_TOPIC_ID = " & Topic_ID & " AND LEFT(TV_DATE,8) = " & iDate

	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.open strSql, my_Conn

	if (rs.EOF or rs.BOF) then 
		my_conn.execute ("INSERT INTO " & strTablePrefix & "TOPIC_VIEWS(TV_TOPIC_ID, TV_VIEWS, TV_DATE) VALUES (" & Topic_ID & ", 1, " & DateToStr(strForumTimeAdjust) & ")")
	else
		my_conn.execute ("UPDATE " & strTablePrefix & "TOPIC_VIEWS SET TV_VIEWS = (TV_VIEWS + 1) WHERE TV_TOPIC_ID=" & Topic_ID & " AND LEFT(TV_DATE,8) = " & iDate )
	end if
	rs.close
	set rs = nothing

And this is what I've come up with to pull the records
strSql = "SELECT TV.TOTAL_VIEWS, T.TOPIC_ID, T.T_SUBJECT, T.T_DATE, F.FORUM_ID, F.F_SUBJECT, C.CAT_ID, C.CAT_NAME " & _ 
         "FROM " & strTablePrefix & "TOPICS T " & _ 
         "INNER JOIN (SELECT SUM(TV_VIEWS) AS TOTAL_VIEWS, TV_TOPIC_ID " & _
                     "FROM " & strTablePrefix & "TOPIC_VIEWS " & _
                     "GROUP BY TV_TOPIC_ID) " & _
         "AS TV " & _
         "ON TV.TV_TOPIC_ID = T.TOPIC_ID " & _
         "INNER JOIN " & strTablePrefix & "FORUM F " & _
         "ON T.FORUM_ID = F.FORUM_ID " & _
         "INNER JOIN " & strTablePrefix & "CATEGORY C " & _
         "ON T.CAT_ID = C.CAT_ID " & _ 
         "ORDER BY TV.TOTAL_VIEWS DESC"

Let me say that query will not work in older versions of mysql and I have no idea if it will work with access. Anyway it's testing fine with mysql 5 and ms sql server express.<

    _-/Cripto9t\-_
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 06 February 2008 :  12:12:24  Show Profile  Visit muzishun's Homepage  Reply with Quote
Cripto, it looks like we're trading back and forth on the same stuff. I'm also planning on tackling this, now that I have the day off work. I think we're approaching it from slightly different angles, so it shouldn't conflict - just add options.<

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 06 February 2008 :  15:58:42  Show Profile  Reply with Quote
Like I said in the other post, I don't have the time to work on these right now. A storm blew through here last night and took out 2 of my trees. There are 3 down in my grandmothers yard. So I'll be busy the next few days cutting next winters firewood.<

    _-/Cripto9t\-_
Go to Top of Page

pitstraight
New Member

Australia
82 Posts

Posted - 06 February 2008 :  23:08:09  Show Profile  Reply with Quote
Ah yes, "by day" sounds good as well.

Thanks guys, all help appreciated ..... and cripto9t, good luck with the wood cutting <
Go to Top of Page

pitstraight
New Member

Australia
82 Posts

Posted - 12 February 2008 :  19:45:15  Show Profile  Reply with Quote
Any progress on this one ?<
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 13 February 2008 :  01:11:56  Show Profile  Visit muzishun's Homepage  Reply with Quote
I haven't made any progress yet. The Post History mod took up more time than I expected it to. I may be able to work on this over the next week or so. Something tells me it will be a little more complex than it seems on the surface, but we shall see.<

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)

Edited by - muzishun on 13 February 2008 01:12:10
Go to Top of Page

pitstraight
New Member

Australia
82 Posts

Posted - 27 February 2008 :  02:44:28  Show Profile  Reply with Quote
* bump *<
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 27 February 2008 :  08:22:51  Show Profile  Reply with Quote
pitstraight, I haven't had much time to put into this lately, but I'm almost finished. Just a few more issues to work out. Hopefully I'll have it ready by this weekend.

Also like I stated before, I have no idea if the db query will work with an access db and I know it won't work with older versions of mySql. I'm testing with mySql 5 and MSSql7. Just to let you know .
<

    _-/Cripto9t\-_
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 27 February 2008 :  08:39:22  Show Profile  Visit AnonJr's Homepage  Reply with Quote
Last I checked, the bigger issues usually run into are things like TOP vs. LIMIT - but if you use the TopSQL() function Snitz has built in you can neatly avoid that problem.

The only other issues I've seen are using reserved words as field names.

Just my 2 cents (USD). <
Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.14 seconds. Powered By: Snitz Forums 2000 Version 3.4.07