View Full Version : [release] Most Popular Threads from Last X Hours
JonnyQuest hacked the Active Threads hack (thank you to those fine contributors to our community) to make this one. He also made a Most Popular Threads ever ... pretty basic mod.
See it included here:
http://www.bigsoccer.com/forum/boards.shtml
dns-error right now ... where could i find this to download?
Likewise, I'm not able to load your page, but this is an AWESOME hack! I've been working on something similar, but I haven't had the time to iron it out recently.
huss, congrats that you're online again - but where's this fine hack to download ?
;)
Hi Huss,
i'm just looking over your site and saw the small message "PM users click here to check messages."
Is this a hack for vB?
Just curious, how do you folks time stamp the most popular posts? I need this feature to highlight the most popular posts of the week.
With UBB i had the server parsing html files for SSI and then executing a custom counter.
Can we take a look at the code please? :)
WHoops my bad, forgot I never put it up!!
Most read Today:
<script language="php">
/*
################################################## ############################
# vBulletin Active Topics Version 0.25 #
################################################## ############################
*/
/*
################################################## ############################
# Load Required Variables #
################################################## ############################
*/
include("admin/config.php");
include("class.FastTemplate.php3");
/*
################################################## ############################
# Set initial directory to load templates from. #
################################################## ############################
*/
$Template_Dir = ".";
/*
################################################## ############################
# Set file to output to if post_to_file is equal to 1. #
################################################## ############################
*/
$Post_File_Name = "mostread.txt";
/*
################################################## ############################
# Initiate FastTemplate #
################################################## ############################
*/
$displaytemplate = new FastTemplate("$Template_Dir");
$displaytemplate->strict();
/*
################################################## ############################
# Setup initial settings if not specified on command line. #
################################################## ############################
*/
if (isset($posts)) {
$num_active = intval($posts);
}
else {
$num_active = 10;
}
if (isset($length)) {
$num_chars = intval($length);
}
else {
$num_chars = 150;
}
if (isset($file)) {
$post_to_file = 1;
$displaytemplate->define(array(
"ActivePage" => "Most-Read-Page.tpl",
"ActiveMessage" => "Most-Read-Message.tpl"
));
}
else {
$post_to_file = 1;
$displaytemplate->define(array(
"ActivePage" => "Most-Read-Page.tpl",
"ActiveMessage" => "Most-Read-Message.tpl"
));
}
if (isset($forum)) {
$selected_forum = intval($forum);
$querylatest = "select * from thread where forumid='$selected_forum' and (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(lastpost))<35000 order by views desc limit $num_active";
}
else {
$querylatest = "select * from thread where (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(lastpost))<35000 order by views desc limit $num_active";
}
/*
################################################## ############################
# Lets Setup and Connect to the Database #
################################################## ############################
*/
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
/*
################################################## ############################
# Generate SQL and Query Database #
################################################## ############################
*/
$resultlatest = mysql_query($querylatest,$db);
/*
################################################## ############################
# Lets Find the Latest Topics #
################################################## ############################
*/
while ($latest_array = mysql_fetch_array($resultlatest)) {
/*
################################################## ############################
# Go one-by-one through the result query. #
################################################## ############################
*/
$query_forum = "select * from forum where forumid='$latest_array[forumid]'";
$result_forum = mysql_query($query_forum,$db);
$forum_info_array = mysql_fetch_array($result_forum);
/*
################################################## ############################
# Split the Date to make it nicer. #
################################################## ############################
*/
$datestr1 = substr($latest_array["dateline"],0,10);
$datetime = substr($latest_array["dateline"],11,8);
/*
################################################## ############################
# Assign result info to template #
################################################## ############################
*/
$displaytemplate->assign ("FORUMTITLE" , $forum_info_array["title"]);
$displaytemplate->assign ("POSTTITLE" , $latest_array["title"]);
$displaytemplate->assign ("POSTUSERNAME" , $latest_array["postusername"]);
$displaytemplate->assign ("POSTDATETIME" , $datetime);
$displaytemplate->assign ("POSTREPLYCOUNT" , $latest_array["replycount"]);
$querythread="select * from post where threadid='$latest_array[threadid]' order by dateline asc limit 1";
$result_thread_text= mysql_query($querythread,$db);
$result_thread_array = mysql_fetch_array($result_thread_text);
$displaytemplate->assign ("POSTICON" , $latest_array["iconid"]);
$displaytemplate->assign ("LASTPOSTER" , $latest_array["lastposter"]);
$displaytemplate->assign ("VIEWS" , $latest_array["views"]);
$Msg = substr(strip_tags($result_thread_array["pagetext"]),0,$num_chars);
$displaytemplate->assign ("POSTMESSAGE" , $Msg);
$displaytemplate->assign ("THREADID" , $latest_array["threadid"]);
$displaytemplate->parse ("FORUMINFO" , ".ActiveMessage");
}
/*
################################################## ############################
# Parse the Data and Output the whole Page #
################################################## ############################
*/
if ($post_to_file == 1) {
$displaytemplate->parse ("GLOBAL" , "ActivePage");
$displaybody = $displaytemplate->fetch("GLOBAL");
$fp = fopen("$Post_File_Name", "w");
fwrite($fp, $displaybody);
fclose($fp);
exit();
}
$displaytemplate->parse ("GLOBAL" , "ActivePage");
$displaytemplate->FastPrint();
exit();
</script>
Most read ever:
<script language="php">
/*
################################################## ############################
# vBulletin Active Topics Version 0.25 #
################################################## ############################
*/
/*
################################################## ############################
# Load Required Variables #
################################################## ############################
*/
include("admin/config.php");
include("class.FastTemplate.php3");
/*
################################################## ############################
# Set initial directory to load templates from. #
################################################## ############################
*/
$Template_Dir = ".";
/*
################################################## ############################
# Set file to output to if post_to_file is equal to 1. #
################################################## ############################
*/
$Post_File_Name = "mostreadever.txt";
/*
################################################## ############################
# Initiate FastTemplate #
################################################## ############################
*/
$displaytemplate = new FastTemplate("$Template_Dir");
$displaytemplate->strict();
/*
################################################## ############################
# Setup initial settings if not specified on command line. #
################################################## ############################
*/
if (isset($posts)) {
$num_active = intval($posts);
}
else {
$num_active = 5;
}
if (isset($length)) {
$num_chars = intval($length);
}
else {
$num_chars = 150;
}
if (isset($file)) {
$post_to_file = 1;
$displaytemplate->define(array(
"ActivePage" => "Most-Read-Page.tpl",
"ActiveMessage" => "Most-Read-Message.tpl"
));
}
else {
$post_to_file = 1;
$displaytemplate->define(array(
"ActivePage" => "Most-Read-Page.tpl",
"ActiveMessage" => "Most-Read-Message.tpl"
));
}
if (isset($forum)) {
$selected_forum = intval($forum);
$querylatest = "select * from thread where forumid='$selected_forum' order by views desc limit $num_active";
}
else {
$querylatest = "select * from thread order by views desc limit $num_active";
}
/*
################################################## ############################
# Lets Setup and Connect to the Database #
################################################## ############################
*/
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
/*
################################################## ############################
# Generate SQL and Query Database #
################################################## ############################
*/
$resultlatest = mysql_query($querylatest,$db);
/*
################################################## ############################
# Lets Find the Latest Topics #
################################################## ############################
*/
while ($latest_array = mysql_fetch_array($resultlatest)) {
/*
################################################## ############################
# Go one-by-one through the result query. #
################################################## ############################
*/
$query_forum = "select * from forum where forumid='$latest_array[forumid]'";
$result_forum = mysql_query($query_forum,$db);
$forum_info_array = mysql_fetch_array($result_forum);
/*
################################################## ############################
# Split the Date to make it nicer. #
################################################## ############################
*/
$datestr1 = substr($latest_array["dateline"],0,10);
$datetime = substr($latest_array["dateline"],11,8);
/*
################################################## ############################
# Assign result info to template #
################################################## ############################
*/
$displaytemplate->assign ("FORUMTITLE" , $forum_info_array["title"]);
$displaytemplate->assign ("POSTTITLE" , $latest_array["title"]);
$displaytemplate->assign ("POSTUSERNAME" , $latest_array["postusername"]);
$displaytemplate->assign ("POSTDATETIME" , $datetime);
$displaytemplate->assign ("POSTREPLYCOUNT" , $latest_array["replycount"]);
$querythread="select * from post where threadid='$latest_array[threadid]' order by dateline asc limit 1";
$result_thread_text= mysql_query($querythread,$db);
$result_thread_array = mysql_fetch_array($result_thread_text);
$displaytemplate->assign ("POSTICON" , $latest_array["iconid"]);
$displaytemplate->assign ("LASTPOSTER" , $latest_array["lastposter"]);
$displaytemplate->assign ("VIEWS" , $latest_array["views"]);
$Msg = substr(strip_tags($result_thread_array["pagetext"]),0,$num_chars);
$displaytemplate->assign ("POSTMESSAGE" , $Msg);
$displaytemplate->assign ("THREADID" , $latest_array["threadid"]);
$displaytemplate->parse ("FORUMINFO" , ".ActiveMessage");
}
/*
################################################## ############################
# Parse the Data and Output the whole Page #
################################################## ############################
*/
if ($post_to_file == 1) {
$displaytemplate->parse ("GLOBAL" , "ActivePage");
$displaybody = $displaytemplate->fetch("GLOBAL");
$fp = fopen("$Post_File_Name", "w");
fwrite($fp, $displaybody);
fclose($fp);
exit();
}
$displaytemplate->parse ("GLOBAL" , "ActivePage");
$displaytemplate->FastPrint();
exit();
</script>
Um.. could you also post the tpl file? :) I still havent figured out FastTemplates well enough to create my own.
Thanks!
Shri
the tpl files all come frm the active threads hack. this is just a hack of a hack.
this is something i have been looking for and i have a problem with both.... running v.1.1.3 beta 3 i have done this
most read daily
http://www.animeboards.net/forums/hotdaily.php3
gives me
Warning: Bad arguments to implode() in class.FastTemplate.php3 on line 157
ERROR: get_template() failure: [./Most-Read-Page.tpl]
most read ever
http://www.animeboards.net/forums/hot.php3
Warning: Bad arguments to implode() in class.FastTemplate.php3 on line 157
ERROR: get_template() failure: [./Most-Read-Message.tpl]
but both bring errors
hmmm... anyone got a solution for my above problem ?
Is the name of your template file: "Most-Read-Message.tpl"?
If so, is it in the same directory as this php file?
i think the problem is the date format changed in vb. you need to change that in the script.
nope , the original tpl file is File-Message.tpl for the original one... which doesn't work properly at
http://animeboards.net/forums/Active.php3 - the showthread url shows /forum instead of /forums/
[Edited by eva2000 on 08-02-2000 at 06:47 AM]
Hi!
I installed this hack, but It doesn't seem to work. I only get a white page, when I run hotdaily.php3 or hotever.php3.
Can anyone help me?
I believe (don't remember the exact configuration) that this script exports a flat text file for you to include with SSI. Look in the script and there should be a variable for the file name.
yes there is a txt file in there... referenced... so should i just create a txt file named like it says in the script in my vb forum directory ?
I meet the same problem like eva2000,
Warning: Bad arguments to implode() in class.FastTemplate.php on line 157
ERROR: get_template() failure: [./Most-Read-Page.tpl]
I used version 1.1.3
and Huss , what do you mean " date format changed in vb." and how to change that.
yeah i still got errors when i add the txt file in references to
Has anyone gotten this to work yet?
nope... haven't got this to work at all ? nor does the normal ActiveTopic hack work :(
The hack works fine but only hot topics ever.
I think there is a problem with the query in mosttoday.php but I don't know how to correct it.
I'm having the same problem.
any solution?
I get a blank white page...anyone know why.
Eva2000 I see you got it to work...can you share how your homepage has those posts and such..
nice site.
Originally posted by VirtueTech
I get a blank white page...anyone know why.
Eva2000 I see you got it to work...can you share how your homepage has those posts and such..
nice site. the one on my page isn't the same hack... mine just shows the last 12 active topics ( as last posted in)... this hack which i still can't get to work shows the most popular threads (number of posts/replies) in the last xx hours..
i have given up on this for now...
Where can I find the hack you have for the last 12 topics? and the other tidbits you have
I downloaded the Active Topics hack and that gave me a blank page as well
[Edited by VirtueTech on 09-08-2000 at 08:31 AM]
Originally posted by VirtueTech
Where can I find the hack you have for the last 12 topics? and the other tidbits you have well all of my frontpage hacks are made thanks to techtalk, jimF and others and are available in 1 thread i made here
http://www.vbulletin.com/forum/showthread.php?threadid=2658
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.