Modifying Adv. Dowloads Block to Advanced Encyclopedia Block

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Modifying Adv. Dowloads Block to Advanced Encyclopedia Block
BombSquad
CZ Super Newbie
 Codezwiz Site Donator
BombSquad has been a member for over 20 year's 20 Year Member
usa.gif alabama.gif
Gender: Male
Status: Offline
Joined: Apr 02, 2004
0.00 posts per day
Posts: 35
Points: 3,162
   
I am using the "Advanced Downloads Block" that shows the following information:
Downloads

Total Files: 34
Total Categories: 7
Total Downloads: 942
Total Served: 3229.47 GB


(Everything below scrolls up with a set amount to view)

Latest Downloads
· 1: Bosnian Ordnance Handbook
[Hits: 1]

· 2: Albanian Munitions Manual
[Hits: 3]


My question is: Is there anyway to modify the following code to use this for my "Encyclopedia" module so that the new block will look like this:

EOD Encyclopedia

Total Categories: ?? (however many I have)
Category title 1: ?? Terms
Category title 2: ?? Terms
Category title 3: ?? Terms

(..... list all categories in module)

(Everything below scrolls up with a set amount to view)

Latest Terms
· 1: Moldovian Striped Bird
[Views: 1]

· 2: Albanian Bassethound
[Views: 3]

Most Viewed Terms
· 1: Moldovian Striped Bird
[Views: 1]

· 2: Albanian Bassethound
[Views: 3]


Big thanks in advance!!!!

<?php

/************************************************************************/
/* Advanced Downloads Block                                             */
/* ===========================                                          */
/*                                                                      */
/* This is basically just an edit of the original block by Francisco.   */
/* Even though this is heavly edited, I think he deserves credit, so:   */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/*                                                                      */
/* Copyright © 2002 by Michael Bacoz                                    */
/* http://www.fatal-instinct.com                                        */
/*                                                                      */
/************************************************************************/

// Make sure people don't try and access it directly
if (eregi("block-Advanced_Downloads.php",$PHP_SELF)) {
    Header("Location: index.html");
    die();
}
/************************/
/*      Variables       */
/************************/
$downloadstoshow = 40;
$usemarquee = 1;
$scrolldirection = "up";

$most = "<b>Most Downloaded</b>";
$latest = "<b>Latest Downloads</b>";
$totalfiles = "<b>Total Files</b>";
$totalcategories = "<b>Total Categories</b>";
$totaldownloads = "<b>Total Downloads</b>";
$hitstext = "Hits";
$totalserved = "<b>Total Served</b>";

/************************/
/*     End Variables    */
/************************/

global $prefix, $dbi, $db;

// Total Files
$result = sql_query("select * from ".$prefix."_downloads_downloads", $dbi);
$files = sql_num_rows($result, $dbi);

// Total Categories
$result = sql_query("select * from ".$prefix."_downloads_categories", $dbi);
$cats = sql_num_rows($result, $dbi);

// Total Downloads
$result = sql_query("select hits from ".$prefix."_downloads_downloads", $dbi);

$a = 1;
while(list($hits) = sql_fetch_row($result, $dbi)) {
     $total_hits = $total_hits + $hits;
      $a++;
}

$result=sql_query("select lid, hits from $prefix"._downloads_downloads." order by lid", $dbi);

$dresult=0;

while(list($lid, $hits) = sql_fetch_row($result, $dbi)) {
   $dresult = $dresult + $hits;
}

$result = sql_query("select * from $prefix"._downloads_downloads."", $dbi);
$numrows = sql_num_rows($result, $dbi);
$result = sql_query("select sum(filesize*hits) as serv from $prefix"._downloads_downloads."", $dbi);

while(list($serv) = sql_fetch_row($result, $dbi)) {
   $served = $serv;
}

$tb = 1024*1024*1024*1024;
$gb = 1024*1024*1024;
$mb = 1024*1024;
$kb = 1024;

if ($served >= $tb){
   $mysizes = sprintf ("%01.2f",$served/$tb) . " TB ";
} elseif ($served >= $gb) {
   $mysizes = sprintf ("%01.2f",$served/$mb) . " GB ";
} elseif ($served >= $mb) {
   $mysizes = sprintf ("%01.2f",$served/$mb) . " MB ";
} elseif ($served >= $kb) {
   $mysizes = sprintf ("%01.2f",$served/$kb) . " KB ";
} else{
   $mysizes = $served . " B ";
}

$content .= "$totalfiles: $files<br>$totalcategories: $cats<br> $totaldownloads: $total_hits<br> $totalserved: $mysizes<br>";

if ($usemarquee == 1) {
   $content .= "<Marquee Behavior=\"Scroll\" Direction=\"$scrolldirection\" ScrollAmount=\"2\" ScrollDelay=\"100\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br>";
}

// Latest added
$content .= $latest."<br>";
$a = 1;
$sql = "select lid, title, hits from ".$prefix."_downloads_downloads order by date DESC limit 0,$downloadstoshow";
$result = $db->sql_query($sql);

while($row = $db->sql_fetchrow($result)) {
   $title2 = ereg_replace ("_", " ", $row[title]);
    $transfertitle = str_replace(" ", "_", $row[title]);
     $content .= "<strong><big>·</big></strong>&nbsp;$a: <a title=\"$title2\" href=\"downloadview-details-$row[lid]-$transfertitle.html\">$title2</a><br>[$hitstext: ".$row['hits']."]<br><br>";
      $a++;
}

// Most downloaded
$content .= "<br>".$most."<br>";
$a = 1;
$sql = "select lid, title, hits from ".$prefix."_downloads_downloads order by hits DESC limit 0,$downloadstoshow";
$result = $db->sql_query($sql);

while($row = $db->sql_fetchrow($result)) {
   $title2 = ereg_replace ("_", " ", $row[title]);
    $transfertitle = str_replace(" ", "_", $row[title]);
    $content .= "<strong><big>·</big></strong>&nbsp;$a: <a title=\"$title2\" href=\"downloadview-details-$row[lid]-$transfertitle.html\">$title2</a><br>[$hitstext: ".$row['hits']."]<br><br>";
    $a++;
}
?>



Back to top Reply with quote
#2   re: Modifying Adv. Dowloads Block to Advanced Encyclopedia B
BombSquad
CZ Super Newbie
 Codezwiz Site Donator
BombSquad has been a member for over 20 year's 20 Year Member
usa.gif alabama.gif
Gender: Male
Status: Offline
Joined: Apr 02, 2004
0.00 posts per day
Posts: 35
Points: 3,162
   
anyone?



Back to top Reply with quote
#3   re: Modifying Adv. Dowloads Block to Advanced Encyclopedia B
BombSquad
CZ Super Newbie
 Codezwiz Site Donator
BombSquad has been a member for over 20 year's 20 Year Member
usa.gif alabama.gif
Gender: Male
Status: Offline
Joined: Apr 02, 2004
0.00 posts per day
Posts: 35
Points: 3,162
   
Can a Mod or Admin move this topic to "Request a Script". I noticed that I posted in the wrong area. Sorry....



Back to top Reply with quote
#4   re: Modifying Adv. Dowloads Block to Advanced Encyclopedia B
mode-x
CZ Newbie
mode-x has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: Nov 18, 2005
0.00 posts per day
Posts: 2
Points: 301
   
Hello ,
To start with I am not claiming to be some master at php in fact I only started using it around 09/11/05 ! however while I was searching for modules and blocks for my new site I came across your request for an Advanced Encyclopedia block and I thought i'd give it a go !
And guess what I made one !!
You can download it at [ Register or login to view links on this board. ] under phpnuke->blocks (NOTE : you will need to be registered)
Sorry If this is a little late from when you posted, but I hope it helps icon_smile.gif

Rich - aka.Mode-X -
Site Administrator for Mode-X.co.uk and ModXbox360.co.uk.



Back to top Reply with quote
#5   re: Modifying Adv. Dowloads Block to Advanced Encyclopedia B
BombSquad
CZ Super Newbie
 Codezwiz Site Donator
BombSquad has been a member for over 20 year's 20 Year Member
usa.gif alabama.gif
Gender: Male
Status: Offline
Joined: Apr 02, 2004
0.00 posts per day
Posts: 35
Points: 3,162
   
thanks man!!! I will give it a try today!!!!!



Back to top Reply with quote
#6   re: Modifying Adv. Dowloads Block to Advanced Encyclopedia B
mode-x
CZ Newbie
mode-x has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: Nov 18, 2005
0.00 posts per day
Posts: 2
Points: 301
   
No problem , if you hav any problems with it please let me know and I will try to recify them , also if you want anythinf else added to it could you let me know as well .
Again I can't promise I will be able to fufill the requests ( I only started to use php start of this month . But I will give it a good go for ya icon_smile.gif

Cheers
Rich



Back to top Reply with quote
#7   re: Modifying Adv. Dowloads Block to Advanced Encyclopedia B
BombSquad
CZ Super Newbie
 Codezwiz Site Donator
BombSquad has been a member for over 20 year's 20 Year Member
usa.gif alabama.gif
Gender: Male
Status: Offline
Joined: Apr 02, 2004
0.00 posts per day
Posts: 35
Points: 3,162
   
nice job man!! really, its just what I was looking for!! I may be contacting you in the future about some other stuff. I wish I could pay you, but the wife has taken away my play money for my site. I guess spending $2500 on it thus far is more than I was supposed to.

Edit: Thank you so much for the block man!! I turned the author information off, but I am adding a "Site Credits" module soon where I will list all the mods etc... that I have installed and will give proper credit there. Kind of a way to keep everything neat and tidy without credits everywhere.



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum