PDA

View Full Version : Modified top.php


SALvation
10-10-2005, 03:49 PM
I changed top.php just a bit to better suit our needs. I changed the order by to DESC and also added the total number of views after the article name. You can see how the change looks here:

http://www.gamemecca.net/forums/showthread.php?t=74695

Just wanted to post this as a suggestion for your next version. Great product by the way. Thanks!

The Geek
10-11-2005, 09:32 AM
Thanks for that - looks good (as does the forum!). Care to attach the ammended top.php for others? (ill fold the asc changes into next iteration).

Sniper
10-12-2005, 02:14 PM
that looks amazing man! The Geek is it ok to use the script, I know its beta nbut I don't wana have to set it up again if you change things.

SALvation
10-12-2005, 03:10 PM
Here is the modified top.php script for anyone that wants it:


<?php
################################################## ################################
## ##
## Geek Article and Review System beta 3 ##
## Stick this file in your forums/gars/mods folder ##
## You could be scolded and publicly humiliated by altering or stealing my code##
## Copyright 2005 by The Geek. Code may not be used in whole ##
## or part without my written permission. You may not distribute this ##
## or any of my files without my written permission. If you do, ##
## you could face imprisonment on some desolate island far from civilization ##
## dweeb. ##
## This pretty box for example is mine. If you copy or modify this pretty box, ##
## my suits will be on you like... well - like suits. Only poorly tailored ##
## cheap suits. People may make fun of you for such cheap suits. ##
## ##
## top.php ##
## Last file chage 26.09.05 ##
## ##
## Copyright ©2005 vBGeek. All Rights Reserved. ##
## This file may not be redistributed in whole or significant part. ##
## ---------------- GARS IS NOT FREE SOFTWARE ---------------- ##
## http://www.thevbgeek.com ##
################################################## ################################
$custom_top_based = array('1'=>'Read', '2'=> 'Active', '3'=> 'Latest');

if ($stage == "display")
{
$title = ($value['settings']['based'] !=3 ? "Top " : "" ) . $custom_top_based[$value['settings']['based']] . " " . $this->type['keywords_c'];
//get all forumids for type
if (is_array($this->settings['forums']))
{
foreach($this->settings['forums'] as $key1=>$value1)
{
if ($value1 == $this->typeid)
{
$forumids .= ",$key1";
}
}
if ($forumids)
{
switch ($value['settings']['based'])
{
case '1':
$orderby = "ORDER BY t.views DESC";
break;
case '2':
$orderby = "ORDER BY t.replycount DESC";
break;
case '3':
$orderby = "ORDER BY t.dateline DESC";
break;
}

$limit = $value['settings']['limit'];
$results = $this->db->query_read("SELECT t.title, t.views, t.replycount, t.threadid FROM " . TABLE_PREFIX . "thread t WHERE t.forumid in (-1$forumids) AND t.visible=1 $orderby LIMIT $limit");
//echo("SELECT t.title, t.views, t.replycount, t.threadid FROM " . TABLE_PREFIX . "thread t WHERE t.forumid in (-1$forumids) $orderby LIMIT $limit");
$bits = "";
while ($result = $this->db->fetch_array($results))
{
$bits .= "<tr><td class='alt2' align='left'><a href='showthread.php?t=$result[threadid]' title='Read more!'>$result[title]</a><br>($result[views] views)</td></tr>";

}

$this->db->free_result($results);
unset($result, $results, $info, $ids);
if ($bits)
{
$bits = "<tr><td class='alt1' align='left'><table border='0' cellspacing='2' cellpadding='5' width='100%'>$bits</table></td></tr>";
eval('$output .="' . fetch_template('GARS_mod_container') . '";');
}
}
}
}
elseif($stage == "settings")
{
print_description_row("This module will display the 'top' threads by type. This is really designed for a side column in the ForumDisplay section.");
print_input_row("Maximum number to show?", "custom_top_limit[$i][$key]", $value['settings']['limit']);
print_select_row("Based on:", "custom_top_based[$i][$key]", $custom_top_based, $value['settings']['based']);
}
elseif($stage == "persistsettings")
{
$modules[$i][$key]['settings']['limit'] = intval($_POST['custom_top_limit'][$i][$key]);
$modules[$i][$key]['settings']['based'] = intval($_POST['custom_top_based'][$i][$key]);
}
?>

The Geek
10-12-2005, 04:30 PM
Thanks for that!