View Single Post
  #8  
Old 06-12-2000, 09:17 AM
Guest
 
Posts: n/a
Default

WHoops my bad, forgot I never put it up!!

Most read Today:
Code:
<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,$dbpassword);
	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:

Code:
<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,$dbpassword);
	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>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01305 seconds
  • Memory Usage 1,836KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete