Home
>
Outdated forums
>
Phorum 3 forums (READ ONLY)
>
Finished Mods and Plug-ins (READ ONLY)
>
Topic
[it works] VIEWS HACK for 3.4.1-stable
Posted by c0330
[it works] VIEWS HACK for 3.4.1-stable February 04, 2003 01:15AM |
Registered: 19 years ago Posts: 10 |
/////////////////////////////////////////////////////////
/
/ VIEWS HACK 2.0a for 3.4.1
/ MySQL only, but easilly adapted
/ Modified by Arthur
////////////////////////////////////////////////////////
!!!!!!BEFORE YOU DO ANYTHING, BACKUP YOUR ENTIRE PHORUM DIR USING ZIP OR TAR!!!!!!!!
It was TESTED and WORKED using Phorum 3.4.1 with PHP 4.2.3 and MySQL 3.23.55
All line numbers for v3.4.1. In newer or older Phorum Versions Lines will be different...
1. Modify read.php (this will increment the view count everytime someone fetches the page):
BEFORE line 184:
$msg_body = new query($DB, $sSQL);
INSERT:
// Views Hack Start
$vSQL = "SELECT * FROM $ForumTableName WHERE id=".$id;
$views = mysql_query($vSQL);
$row = mysql_fetch_array($views);
$vSQL = "UPDATE $ForumTableName SET views=" . ($row["views"] + 1) . " WHERE id=$id";
mysql_query($vSQL);
// Views Hack End
2. Modify db/mysql.php (this will make sure all new forums get the extra views column):
REPLACE line 167:
function create_table(&$DB, $table, $table_name){
global $q;
switch($table){
case "main":
$sSQL="CREATE TABLE $table_name (
id int unsigned DEFAULT '0' NOT NULL,
datestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
thread int unsigned DEFAULT '0' NOT NULL,
parent int unsigned DEFAULT '0' NOT NULL,
author char(37) DEFAULT '' NOT NULL,
subject char(255) DEFAULT '' NOT NULL,
email char(200) DEFAULT '' NOT NULL,
host varchar(255) DEFAULT '' NOT NULL,
email_reply char(1) NOT NULL DEFAULT 'N',
approved char(1) NOT NULL DEFAULT 'N',
msgid char(100) DEFAULT '' NOT NULL,
modifystamp int unsigned DEFAULT '0' NOT NULL,
userid int unsigned DEFAULT 0 NOT NULL,
closed tinyint DEFAULT 0 NOT NULL,
PRIMARY KEY (id),
KEY author (author),
KEY userid (userid),
KEY datestamp (datestamp),
KEY subject (subject),
KEY thread (thread),
KEY parent (parent),
KEY approved (approved),
KEY msgid (msgid),
KEY modifystamp (modifystamp)
)";
WITH :
function create_table(&$DB, $table, $table_name){
global $q;
switch($table){
case "main":
$sSQL="CREATE TABLE $table_name (
id int unsigned DEFAULT '0' NOT NULL,
datestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
thread int unsigned DEFAULT '0' NOT NULL,
parent int unsigned DEFAULT '0' NOT NULL,
author char(37) DEFAULT '' NOT NULL,
subject char(255) DEFAULT '' NOT NULL,
email char(200) DEFAULT '' NOT NULL,
host varchar(255) DEFAULT '' NOT NULL,
email_reply char(1) NOT NULL DEFAULT 'N',
approved char(1) NOT NULL DEFAULT 'N',
msgid char(100) DEFAULT '' NOT NULL,
modifystamp int unsigned DEFAULT '0' NOT NULL,
userid int unsigned DEFAULT 0 NOT NULL,
closed tinyint DEFAULT 0 NOT NULL,
views INT(7) DEFAULT '0',
PRIMARY KEY (id),
KEY author (author),
KEY userid (userid),
KEY datestamp (datestamp),
KEY subject (subject),
KEY thread (thread),
KEY parent (parent),
KEY approved (approved),
KEY msgid (msgid),
KEY modifystamp (modifystamp)
)";
3. Modify list.php (enable views fetching from db):
REPLACE line 176 AND 274:
if($$phcollapse==0){
$SQL = "Select id,parent,thread,subject,author,datestamp,userid from $ForumTableName where approved='Y' AND thread<=$max and thread>=$min order by thread desc, id asc";
}
else{
$SQL = "Select id,thread,subject,author,datestamp,userid from $ForumTableName where approved='Y' AND thread = id AND thread<=$max AND thread>=$min order by thread desc";
}
WITH:
if($$phcollapse==0){
$SQL = "Select id,parent,thread,subject,author,datestamp,userid,views from $ForumTableName where approved='Y' AND thread<=$max and thread>=$min order by thread desc, id asc";
}
else{
$SQL = "Select id,thread,subject,author,datestamp,userid,views from $ForumTableName where approved='Y' AND thread = id AND thread<=$max AND thread>=$min order by thread desc";
}
4.1 Modify include/multi-threads.php (to display the actual views):
AFTER line 21:
$thread_total="";
INSERT:
$views = $topic["views"];
4.2 Modify include/multi-threads.php (to display the $views):
REPLACE line 196:
<table class="PhorumListTable" width="<?php echo $ForumTableWidth;?>" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td class="PhorumListHeader"<?php echo bgcolor($ForumTableHeaderColor);?>><font color="<?php echo $ForumTableHeaderFontColor; ?>"> <?php echo $lTopics;?><img src="images/trans.gif" border="0" width=1 height=24 align="absmiddle"></font></td>
<td class="PhorumListHeader"<?php echo bgcolor($ForumTableHeaderColor);?> nowrap width=150><font color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lAuthor;?> </font></td>
<td class="PhorumListHeader"<?php echo bgcolor($ForumTableHeaderColor);?> nowrap width=150><font color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lDate;?></font></td>
</tr>
WITH:
<table class="PhorumListTable" width="<?php echo $ForumTableWidth;?>" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="PhorumListHeader"<?php echo bgcolor($ForumTableHeaderColor);?>><font color="<?php echo $ForumTableHeaderFontColor; ?>"> <?php echo $lTopics;?><img src="images/trans.gif" border="0" width=1 height=24 align="absmiddle"></font></td>
<td class="PhorumListHeader"<?php echo bgcolor($ForumTableHeaderColor);?> nowrap="nowrap" width=150><font color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lAuthor;?> </font></td>
<td class="PhorumListHeader"<?PHP echo bgcolor($ForumTableHeaderColor);?> nowrap="nowrap" width=80><font color="<?php echo $ForumTableHeaderFontColor; ?>">Views</font></td>
<td class="PhorumListHeader"<?php echo bgcolor($ForumTableHeaderColor);?> nowrap="nowrap" width=150><font color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lDate;?></font></td>
</tr>
4.3 Modify include/multi-threads.php (to display the tables for $views):
REPLACE line 82:
<tr valign=middle>
<td class="PhorumListRow" <?php echo bgcolor($bgcolor);?>><?php echo $subject;?></td>
<td class="PhorumListRow" <?php echo bgcolor($bgcolor);?> nowrap><font color="<?php echo $font_color;?>"><?php echo $author;?></font></td>
<td class="PhorumListRow" <?php echo bgcolor($bgcolor);?> nowrap><font color="<?php echo $font_color;?>"><?php echo $datestamp;?> </font></td>
</tr>
WITH:
<tr valign=middle>
<td class="PhorumListRow" <?php echo bgcolor($bgcolor);?>><?php echo $subject;?></td>
<td class="PhorumListRow" <?php echo bgcolor($bgcolor);?> nowrap="nowrap"><font color="<?php echo $font_color;?>"><?php echo $author;?></font></td>
<td class="PhorumListRow" <?PHP echo bgcolor($bgcolor);?> nowrap="nowrap"><font color="<?php echo $font_color;?>"><?php echo $views;?></font></td>
<td class="PhorumListRow" <?php echo bgcolor($bgcolor);?> nowrap="nowrap"><font color="<?php echo $font_color;?>"><?php echo $datestamp;?> </font></td>
</tr>
5.1 Modify include/threads.php (to display the actual views):
BEFORE line 56:
$message = next($headers);
INSERT:
$views = $message["views"];
5.2 Modify include/threads.php (to display the $views):
REPLACE line 10:
<table class="PhorumListTable" width="<?php echo $ForumTableWidth; ?>" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?>><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"> <?php echo $lTopics;?><img src="images/trans.gif" border=0 width=1 height=24 align="absmiddle"></font></td>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="150" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lAuthor;?> </font></td>
<?php if ( empty($read) && $$phcollapse != 0) { ?>
<td class="PhorumListHeader" align="center" <?php echo bgcolor($ForumTableHeaderColor); ?> width="80" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lReplies;?> </font></td>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="120" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lLatest;?></font></td>
<?php }else{ ?>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="120" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lDate;?></font></td>
<?php } ?>
</tr>
replace with:
<table class="PhorumListTable" width="<?php echo $ForumTableWidth; ?>" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?>><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"> <?php echo $lTopics;?><img src="images/trans.gif" border=0 width=1 height=24 align="absmiddle"></font></td>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="150" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lAuthor;?> </font></td>
<?php if ( empty($read) && $$phcollapse != 0) { ?>
<td class="PhorumListHeader" align="center" <?php echo bgcolor($ForumTableHeaderColor); ?> width="80" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lReplies;?> </font></td>
<td class="PhorumListHeader" align="center" <?php echo bgcolor($ForumTableHeaderColor); ?> width="80" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>">Views </font></td>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="120" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lLatest;?></font></td>
<?php }else{ ?>
<td class="PhorumListHeader" align="center" <?php echo bgcolor($ForumTableHeaderColor); ?> width="80" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>">Views </font></td>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="120" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lDate;?></font></td>
<?php } ?>
</tr>
5.3 Modify include/threads.php (to display the tables for $views):
REPLACE line 116:
echo "</td>\n";
echo ' <td class="PhorumListRow" width="150" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'">'.$t_author.' </font></td>'."\n";
if( $$phcollapse != 0 && empty($read) ){
$t_count=$trec["tcount"]-1;
if(!empty($message)) $trec=$threads[$message["thread"]];
echo ' <td class="PhorumListRow" align="center" width="80" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'" size=-1>'.$t_count." </font></td>\n";
echo ' <td class="PhorumListRow" width="120" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'" size=-1>'.$t_latest." </font></td>\n";
}
WITH:
echo "</td>\n";
echo ' <td class="PhorumListRow" width="150" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'">'.$t_author.' </font></td>'."\n";
if( $$phcollapse != 0 && empty($read) ){
$t_count=$trec["tcount"]-1;
if(!empty($message)) $trec=$threads[$message["thread"]];
echo ' <td class="PhorumListRow" align="center" width="80" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'" size=-1>'.$t_count." </font></td>\n";
echo ' <td class="PhorumListRow" align="center" width="80" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'">'.$views.' </font></td>'."\n";
echo ' <td class="PhorumListRow" width="120" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'" size=-1>'.$t_latest." </font></td>\n";
}
6. Now go to MySQL, add a new colume to the data base
Do this with every forum.
ALTER TABLE <forumname> ADD views INT(7) DEFAULT '0';
Good Luck!
You will know what is happening from my forum (traditional chinese)
[info.yingwa.edu.hk]
P.S. Sorry for my bad english... I am only a college students in HongKong!
~Arthur
Post Edited (02-22-03 05:49)
/
/ VIEWS HACK 2.0a for 3.4.1
/ MySQL only, but easilly adapted
/ Modified by Arthur
////////////////////////////////////////////////////////
!!!!!!BEFORE YOU DO ANYTHING, BACKUP YOUR ENTIRE PHORUM DIR USING ZIP OR TAR!!!!!!!!
It was TESTED and WORKED using Phorum 3.4.1 with PHP 4.2.3 and MySQL 3.23.55
All line numbers for v3.4.1. In newer or older Phorum Versions Lines will be different...
1. Modify read.php (this will increment the view count everytime someone fetches the page):
BEFORE line 184:
$msg_body = new query($DB, $sSQL);
INSERT:
// Views Hack Start
$vSQL = "SELECT * FROM $ForumTableName WHERE id=".$id;
$views = mysql_query($vSQL);
$row = mysql_fetch_array($views);
$vSQL = "UPDATE $ForumTableName SET views=" . ($row["views"] + 1) . " WHERE id=$id";
mysql_query($vSQL);
// Views Hack End
2. Modify db/mysql.php (this will make sure all new forums get the extra views column):
REPLACE line 167:
function create_table(&$DB, $table, $table_name){
global $q;
switch($table){
case "main":
$sSQL="CREATE TABLE $table_name (
id int unsigned DEFAULT '0' NOT NULL,
datestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
thread int unsigned DEFAULT '0' NOT NULL,
parent int unsigned DEFAULT '0' NOT NULL,
author char(37) DEFAULT '' NOT NULL,
subject char(255) DEFAULT '' NOT NULL,
email char(200) DEFAULT '' NOT NULL,
host varchar(255) DEFAULT '' NOT NULL,
email_reply char(1) NOT NULL DEFAULT 'N',
approved char(1) NOT NULL DEFAULT 'N',
msgid char(100) DEFAULT '' NOT NULL,
modifystamp int unsigned DEFAULT '0' NOT NULL,
userid int unsigned DEFAULT 0 NOT NULL,
closed tinyint DEFAULT 0 NOT NULL,
PRIMARY KEY (id),
KEY author (author),
KEY userid (userid),
KEY datestamp (datestamp),
KEY subject (subject),
KEY thread (thread),
KEY parent (parent),
KEY approved (approved),
KEY msgid (msgid),
KEY modifystamp (modifystamp)
)";
WITH :
function create_table(&$DB, $table, $table_name){
global $q;
switch($table){
case "main":
$sSQL="CREATE TABLE $table_name (
id int unsigned DEFAULT '0' NOT NULL,
datestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
thread int unsigned DEFAULT '0' NOT NULL,
parent int unsigned DEFAULT '0' NOT NULL,
author char(37) DEFAULT '' NOT NULL,
subject char(255) DEFAULT '' NOT NULL,
email char(200) DEFAULT '' NOT NULL,
host varchar(255) DEFAULT '' NOT NULL,
email_reply char(1) NOT NULL DEFAULT 'N',
approved char(1) NOT NULL DEFAULT 'N',
msgid char(100) DEFAULT '' NOT NULL,
modifystamp int unsigned DEFAULT '0' NOT NULL,
userid int unsigned DEFAULT 0 NOT NULL,
closed tinyint DEFAULT 0 NOT NULL,
views INT(7) DEFAULT '0',
PRIMARY KEY (id),
KEY author (author),
KEY userid (userid),
KEY datestamp (datestamp),
KEY subject (subject),
KEY thread (thread),
KEY parent (parent),
KEY approved (approved),
KEY msgid (msgid),
KEY modifystamp (modifystamp)
)";
3. Modify list.php (enable views fetching from db):
REPLACE line 176 AND 274:
if($$phcollapse==0){
$SQL = "Select id,parent,thread,subject,author,datestamp,userid from $ForumTableName where approved='Y' AND thread<=$max and thread>=$min order by thread desc, id asc";
}
else{
$SQL = "Select id,thread,subject,author,datestamp,userid from $ForumTableName where approved='Y' AND thread = id AND thread<=$max AND thread>=$min order by thread desc";
}
WITH:
if($$phcollapse==0){
$SQL = "Select id,parent,thread,subject,author,datestamp,userid,views from $ForumTableName where approved='Y' AND thread<=$max and thread>=$min order by thread desc, id asc";
}
else{
$SQL = "Select id,thread,subject,author,datestamp,userid,views from $ForumTableName where approved='Y' AND thread = id AND thread<=$max AND thread>=$min order by thread desc";
}
4.1 Modify include/multi-threads.php (to display the actual views):
AFTER line 21:
$thread_total="";
INSERT:
$views = $topic["views"];
4.2 Modify include/multi-threads.php (to display the $views):
REPLACE line 196:
<table class="PhorumListTable" width="<?php echo $ForumTableWidth;?>" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td class="PhorumListHeader"<?php echo bgcolor($ForumTableHeaderColor);?>><font color="<?php echo $ForumTableHeaderFontColor; ?>"> <?php echo $lTopics;?><img src="images/trans.gif" border="0" width=1 height=24 align="absmiddle"></font></td>
<td class="PhorumListHeader"<?php echo bgcolor($ForumTableHeaderColor);?> nowrap width=150><font color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lAuthor;?> </font></td>
<td class="PhorumListHeader"<?php echo bgcolor($ForumTableHeaderColor);?> nowrap width=150><font color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lDate;?></font></td>
</tr>
WITH:
<table class="PhorumListTable" width="<?php echo $ForumTableWidth;?>" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="PhorumListHeader"<?php echo bgcolor($ForumTableHeaderColor);?>><font color="<?php echo $ForumTableHeaderFontColor; ?>"> <?php echo $lTopics;?><img src="images/trans.gif" border="0" width=1 height=24 align="absmiddle"></font></td>
<td class="PhorumListHeader"<?php echo bgcolor($ForumTableHeaderColor);?> nowrap="nowrap" width=150><font color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lAuthor;?> </font></td>
<td class="PhorumListHeader"<?PHP echo bgcolor($ForumTableHeaderColor);?> nowrap="nowrap" width=80><font color="<?php echo $ForumTableHeaderFontColor; ?>">Views</font></td>
<td class="PhorumListHeader"<?php echo bgcolor($ForumTableHeaderColor);?> nowrap="nowrap" width=150><font color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lDate;?></font></td>
</tr>
4.3 Modify include/multi-threads.php (to display the tables for $views):
REPLACE line 82:
<tr valign=middle>
<td class="PhorumListRow" <?php echo bgcolor($bgcolor);?>><?php echo $subject;?></td>
<td class="PhorumListRow" <?php echo bgcolor($bgcolor);?> nowrap><font color="<?php echo $font_color;?>"><?php echo $author;?></font></td>
<td class="PhorumListRow" <?php echo bgcolor($bgcolor);?> nowrap><font color="<?php echo $font_color;?>"><?php echo $datestamp;?> </font></td>
</tr>
WITH:
<tr valign=middle>
<td class="PhorumListRow" <?php echo bgcolor($bgcolor);?>><?php echo $subject;?></td>
<td class="PhorumListRow" <?php echo bgcolor($bgcolor);?> nowrap="nowrap"><font color="<?php echo $font_color;?>"><?php echo $author;?></font></td>
<td class="PhorumListRow" <?PHP echo bgcolor($bgcolor);?> nowrap="nowrap"><font color="<?php echo $font_color;?>"><?php echo $views;?></font></td>
<td class="PhorumListRow" <?php echo bgcolor($bgcolor);?> nowrap="nowrap"><font color="<?php echo $font_color;?>"><?php echo $datestamp;?> </font></td>
</tr>
5.1 Modify include/threads.php (to display the actual views):
BEFORE line 56:
$message = next($headers);
INSERT:
$views = $message["views"];
5.2 Modify include/threads.php (to display the $views):
REPLACE line 10:
<table class="PhorumListTable" width="<?php echo $ForumTableWidth; ?>" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?>><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"> <?php echo $lTopics;?><img src="images/trans.gif" border=0 width=1 height=24 align="absmiddle"></font></td>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="150" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lAuthor;?> </font></td>
<?php if ( empty($read) && $$phcollapse != 0) { ?>
<td class="PhorumListHeader" align="center" <?php echo bgcolor($ForumTableHeaderColor); ?> width="80" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lReplies;?> </font></td>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="120" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lLatest;?></font></td>
<?php }else{ ?>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="120" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lDate;?></font></td>
<?php } ?>
</tr>
replace with:
<table class="PhorumListTable" width="<?php echo $ForumTableWidth; ?>" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?>><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"> <?php echo $lTopics;?><img src="images/trans.gif" border=0 width=1 height=24 align="absmiddle"></font></td>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="150" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lAuthor;?> </font></td>
<?php if ( empty($read) && $$phcollapse != 0) { ?>
<td class="PhorumListHeader" align="center" <?php echo bgcolor($ForumTableHeaderColor); ?> width="80" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lReplies;?> </font></td>
<td class="PhorumListHeader" align="center" <?php echo bgcolor($ForumTableHeaderColor); ?> width="80" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>">Views </font></td>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="120" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lLatest;?></font></td>
<?php }else{ ?>
<td class="PhorumListHeader" align="center" <?php echo bgcolor($ForumTableHeaderColor); ?> width="80" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>">Views </font></td>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="120" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lDate;?></font></td>
<?php } ?>
</tr>
5.3 Modify include/threads.php (to display the tables for $views):
REPLACE line 116:
echo "</td>\n";
echo ' <td class="PhorumListRow" width="150" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'">'.$t_author.' </font></td>'."\n";
if( $$phcollapse != 0 && empty($read) ){
$t_count=$trec["tcount"]-1;
if(!empty($message)) $trec=$threads[$message["thread"]];
echo ' <td class="PhorumListRow" align="center" width="80" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'" size=-1>'.$t_count." </font></td>\n";
echo ' <td class="PhorumListRow" width="120" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'" size=-1>'.$t_latest." </font></td>\n";
}
WITH:
echo "</td>\n";
echo ' <td class="PhorumListRow" width="150" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'">'.$t_author.' </font></td>'."\n";
if( $$phcollapse != 0 && empty($read) ){
$t_count=$trec["tcount"]-1;
if(!empty($message)) $trec=$threads[$message["thread"]];
echo ' <td class="PhorumListRow" align="center" width="80" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'" size=-1>'.$t_count." </font></td>\n";
echo ' <td class="PhorumListRow" align="center" width="80" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'">'.$views.' </font></td>'."\n";
echo ' <td class="PhorumListRow" width="120" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'" size=-1>'.$t_latest." </font></td>\n";
}
6. Now go to MySQL, add a new colume to the data base
Do this with every forum.
ALTER TABLE <forumname> ADD views INT(7) DEFAULT '0';
Good Luck!
You will know what is happening from my forum (traditional chinese)
[info.yingwa.edu.hk]
P.S. Sorry for my bad english... I am only a college students in HongKong!
~Arthur
Post Edited (02-22-03 05:49)
Re: Views hack for 3.4.1-stable February 04, 2003 01:16AM |
Registered: 19 years ago Posts: 10 |
nothing...
see [itforum.ez2.us] for the result .
P.S. This is a forum in traditional chinese !
Post Edited (02-22-03 05:50)
see [itforum.ez2.us] for the result .
P.S. This is a forum in traditional chinese !
Post Edited (02-22-03 05:50)
No Subject February 04, 2003 08:55AM |
Registered: 19 years ago Posts: 10 |
Re: [it works] VIEWS HACK for 3.4.1-stable February 14, 2003 01:35PM |
Registered: 19 years ago Posts: 14 |
Re: [it works] VIEWS HACK for 3.4.1-stable February 15, 2003 07:49AM |
Registered: 19 years ago Posts: 1 |
I had the same problem, I copied the php script from Macromedia into the phorum dir, and I had the same problem as you, I found out that madromedia was changing some codes into directory items like F://path to phorum...
so I copied the scripts by Explorer into the phorum dir and everything is running fine now
see [plein.veteranen.info]
mabye this will help you.....
friendly
Rob
Post Edited (02-15-03 06:50)
so I copied the scripts by Explorer into the phorum dir and everything is running fine now
see [plein.veteranen.info]
mabye this will help you.....
friendly
Rob
Post Edited (02-15-03 06:50)
Re: [it works] VIEWS HACK for 3.4.1-stable February 15, 2003 09:06AM |
Registered: 19 years ago Posts: 14 |
Hi Rob,
Your forum works fine, I left you a message ;)
But mine does not function. Could you send your script to me? or the modification which you made compared to original script See my forum here: [www.franceorage.com]
--
Jo
Your forum works fine, I left you a message ;)
But mine does not function. Could you send your script to me? or the modification which you made compared to original script See my forum here: [www.franceorage.com]
--
Jo
Re: [it works] VIEWS HACK for 3.4.1-stable February 18, 2003 02:34AM |
Registered: 19 years ago Posts: 10 |
Re: [it works] VIEWS HACK for 3.4.1-stable February 18, 2003 06:29AM |
Registered: 19 years ago Posts: 14 |
i had the same problem... February 19, 2003 05:30PM |
Registered: 19 years ago Posts: 7 |
...where no messages at all were listed. I believe I am running 3.4.1. The problems were in the changes to list.php. By subsituting Step 3 with these changes, I did fine.
REPLACE line 176:
if($$phcollapse==0){
$SQL = "Select id,parent,thread,subject,author,datestamp,userid from $ForumTableName WHERE approved='Y' $myflag and thread IN (".$threadstring.") order by modifystamp desc, id asc";
}
else {
$SQL = "Select id,0 as parent,thread,subject,author,datestamp,userid from $ForumTableName WHERE approved='Y' AND parent = 0 $myflag and thread IN (".$threadstring.") order by modifystamp desc";
}
WITH:
if($$phcollapse==0){
$SQL = "Select id,parent,thread,subject,author,datestamp,userid,views from $ForumTableName WHERE approved='Y' $myflag and thread IN (".$threadstring.") order by modifystamp desc, id asc";
}
else {
$SQL = "Select id,0 as parent,thread,subject,author,datestamp,userid,views from $ForumTableName WHERE approved='Y' AND parent = 0 $myflag and thread IN (".$threadstring.") order by modifystamp desc";
}
AND THEN REPLACE line 274:
if($$phcollapse==0){
$SQL = "Select id,parent,thread,subject,author,datestamp,userid,views from $ForumTableName where approved='Y' AND thread<=$max and thread>=$min order by thread desc, id asc";
}
else{
$SQL = "Select id,thread,subject,author,datestamp,userid,views from $ForumTableName where approved='Y' AND thread = id AND thread<=$max AND thread>=$min order by thread desc";
}
WITH:
if($$phcollapse==0){
$SQL = "Select id,parent,thread,subject,author,datestamp,userid,views from $ForumTableName where approved='Y' AND thread<=$max and thread>=$min order by thread desc, id asc";
}
else{
$SQL = "Select id,thread,subject,author,datestamp,userid,views from $ForumTableName where approved='Y' AND thread = id AND thread<=$max AND thread>=$min order by thread desc";
}
Both lines needed to be replaced seperately as the original code is slightly different (even though the changes made are the same).
I migh have old code, but either way this worked for me.
GHXC
(edited to fix line #'s)
Post Edited (02-19-03 16:32)
REPLACE line 176:
if($$phcollapse==0){
$SQL = "Select id,parent,thread,subject,author,datestamp,userid from $ForumTableName WHERE approved='Y' $myflag and thread IN (".$threadstring.") order by modifystamp desc, id asc";
}
else {
$SQL = "Select id,0 as parent,thread,subject,author,datestamp,userid from $ForumTableName WHERE approved='Y' AND parent = 0 $myflag and thread IN (".$threadstring.") order by modifystamp desc";
}
WITH:
if($$phcollapse==0){
$SQL = "Select id,parent,thread,subject,author,datestamp,userid,views from $ForumTableName WHERE approved='Y' $myflag and thread IN (".$threadstring.") order by modifystamp desc, id asc";
}
else {
$SQL = "Select id,0 as parent,thread,subject,author,datestamp,userid,views from $ForumTableName WHERE approved='Y' AND parent = 0 $myflag and thread IN (".$threadstring.") order by modifystamp desc";
}
AND THEN REPLACE line 274:
if($$phcollapse==0){
$SQL = "Select id,parent,thread,subject,author,datestamp,userid,views from $ForumTableName where approved='Y' AND thread<=$max and thread>=$min order by thread desc, id asc";
}
else{
$SQL = "Select id,thread,subject,author,datestamp,userid,views from $ForumTableName where approved='Y' AND thread = id AND thread<=$max AND thread>=$min order by thread desc";
}
WITH:
if($$phcollapse==0){
$SQL = "Select id,parent,thread,subject,author,datestamp,userid,views from $ForumTableName where approved='Y' AND thread<=$max and thread>=$min order by thread desc, id asc";
}
else{
$SQL = "Select id,thread,subject,author,datestamp,userid,views from $ForumTableName where approved='Y' AND thread = id AND thread<=$max AND thread>=$min order by thread desc";
}
Both lines needed to be replaced seperately as the original code is slightly different (even though the changes made are the same).
I migh have old code, but either way this worked for me.
GHXC
(edited to fix line #'s)
Post Edited (02-19-03 16:32)
ATTN: Joakim - Collapse View bug February 19, 2003 07:08PM |
Registered: 19 years ago Posts: 7 |
I had the same problem in collapse view. If you look carefully you'll notice ALL the numbering is off (shifted "up") in the collapse view. It has to do with one of the lines in the threads.php file.
In the original Install Instructions substitute the following for step 5.1:
5.1 Modify include/threads.php (to display the actual views):
*BEFORE* line 56:
$message = next($headers);
INSERT:
$views = $message["views"];
If the install is complete, just swap the two lines and you'll be fine.
Hope this helps!
GHXC
In the original Install Instructions substitute the following for step 5.1:
5.1 Modify include/threads.php (to display the actual views):
*BEFORE* line 56:
$message = next($headers);
INSERT:
$views = $message["views"];
If the install is complete, just swap the two lines and you'll be fine.
Hope this helps!
GHXC
Re: ATTN: Joakim - Collapse View bug February 19, 2003 08:26PM |
Registered: 19 years ago Posts: 14 |
greg hxc wrote:
> 5.1 Modify include/threads.php (to display the actual views):
>
> *BEFORE* line 56:
> $message = next($headers);
>
> INSERT:
> $views = $message["views"];
Yes, I had included these two lines like this:
$message = next($headers);
$views = $message["views"];
But by modifying them like that:
$views = $message["views"];
$message = next($headers);
All functions well now
thank you very much ;)
--
Jo
> 5.1 Modify include/threads.php (to display the actual views):
>
> *BEFORE* line 56:
> $message = next($headers);
>
> INSERT:
> $views = $message["views"];
Yes, I had included these two lines like this:
$message = next($headers);
$views = $message["views"];
But by modifying them like that:
$views = $message["views"];
$message = next($headers);
All functions well now
thank you very much ;)
--
Jo
Re: [it works] VIEWS HACK for 3.4.1-stable March 05, 2003 09:36AM |
Registered: 19 years ago Posts: 33 |
Re: [it works] VIEWS HACK for 3.4.1-stable March 08, 2003 03:34PM |
Registered: 19 years ago Posts: 5 |
No Subject March 08, 2003 03:35PM |
Registered: 19 years ago Posts: 5 |
Anonymous User
Re: [it works] VIEWS HACK for 3.4.1-stable May 08, 2003 02:32PM |
Re: [it works] VIEWS HACK for 3.4.1-stable June 15, 2003 09:10AM |
Registered: 19 years ago Posts: 10 |
Hi,
I am using Phorum 3.4.3a with MySQL and don't have any problem (with greg hxc's fix).
If you want to have a look at the result:
[www.easyexpat.com]
Just a remark. It would be better, when we use the flat view, if all the messages of the thread are updated at the same time when you view them, instead of only the first one...
Cyril
I am using Phorum 3.4.3a with MySQL and don't have any problem (with greg hxc's fix).
If you want to have a look at the result:
[www.easyexpat.com]
Just a remark. It would be better, when we use the flat view, if all the messages of the thread are updated at the same time when you view them, instead of only the first one...
Cyril
Anonymous User
Re: [it works] VIEWS HACK for 3.4.1-stable July 04, 2003 09:55PM |
Re: [it works] VIEWS HACK for 3.4.1-stable October 11, 2003 09:52AM |
Works sweet at [happymtb.org] as well.
An addition to the SQL part for the beginner;
Before you run "ALTER TABLE <forumname> ADD views INT(7) DEFAULT '0';" in mysql you have to run "USE <databasename>".
An addition to the SQL part for the beginner;
Before you run "ALTER TABLE <forumname> ADD views INT(7) DEFAULT '0';" in mysql you have to run "USE <databasename>".
Nickwe
Re: [it works] VIEWS HACK for 3.4.1-stable January 03, 2004 01:36PM |
Sorry, you do not have permission to post/reply in this forum.