Firefox PHP

[it works] VIEWS HACK for 3.4.1-stable

Posted by c0330 
A suggestion for threads.php, this will sum up all views that the particular thread has got (right now, in the thread-view there are only viewcounts for the first message of that thread)

REPLACE line 77 and following in include/threads.php:

else{
$t_subject="<a href=\"$read_page.$ext?f=$num&i=$t_id&t=$t_thread$GetVars\">$t_subject</a>";
}

WITH:

else{
$sSQL="SELECT SUM(views) as summe FROM $ForumTableName WHERE thread='$t_thread'";
$q->query($DB, $sSQL);
$aryRow=$q->getrow();
$t_hits = $aryRow["summe"];
if (!isset($t_hits)) $t_hits=0;
$t_subject="<a href=\"$read_page.$ext?f=$num&i=$t_id&t=$t_thread$GetVars\">$t_subject</a> ($t_hits $lHits)";
}

This will work in Phorum 3.4.6.

Hope this helps,
Marian
An addition to my post from yesterday:
My code will display the number of views right after the subject but not in a special column (as does the original code for the views-hack). You also need to define the language variable $lHits (in my case, it says " x gelesen" for " x read").

Cheers,
Marian
Hi,

I've some problems with the SQL part, that's because om still a newby when we talking about SQL.

Where do I use :

ALTER TABLE <forumname> ADD views INT(7) DEFAULT '0';

Is this in the phpMyAdmin, and use it like a SQL query ? Or is there a programm to change this easy. I know something about databases, but have some probs with MySQL.

I'm using Windows 2000 with :

- phpMyAdmin Database Manager Version 2.5.4
- Apache WebServer Version 1.3.29
- PHP Script Language Version 4.3.4
- MySQL Database Version 4.0.16

grtz,
Sammy
forget the last post, read some faq's about sql and now know how to do it
Very useful thanks a lot to the hackers
i don't know where i got wrong but it seems to count per 2 ???
I'm using new phorum 3.4.7 :
[permutation.free.fr]
('i still have a CSS problem wih forum tables integration in IE )
Re: [it works] VIEWS HACK for 3.4.1-stable
July 08, 2004 05:47PM
Hi,

ist the views hack for 3.4.8a working, too?
Any problems?

Regards, Stoebi
Got this working on 3.4.7

Regards,
Mike Woods,
[www.fruitchat.co.uk] - Fruit Machine Chat
Re: [it works] VIEWS HACK for 3.4.1-stable
August 13, 2004 06:01PM
Great hack!!! You saved me a whole lot of time. :)

I have created an installer zip file for this hack for Phorum Version 3.4.8a (with all the changes already added to it). If anyone else needs it, you can download it from here:

phorum-3.4.8a_views_hack.zip



Post Edited (08-13-04 11:01)

regards
mt
Sorry, you do not have permission to post/reply in this forum.