Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...
Author Message
SpaceMonkey
Worker
Worker


Joined: Apr 30, 2005
Posts: 170

PostPosted: Sat Sep 03, 2005 10:22 pm Reply with quote

I'd like a block that states the 10 most recently added downloads. Anyone know where I might find such a block? Smile
 
View user's profile Send private message Visit poster's website
Nukeum66
Life Cycles Becoming CPU Cycles


Joined: Jul 30, 2003
Posts: 551
Location: Neurotic, State, USA

PostPosted: Sun Sep 04, 2005 11:28 pm Reply with quote

This will work if you are using the standard Downloads module. This is really the block-Top10_Downloads.php that comes with PHP-Nuke with a small change to re-order the downloads by DATE and not HITS.
Copy and save as block-Most_Recent_Downloads.php
Code:
<?php


/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* 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.       */
/************************************************************************/
/*         Additional security & Abstraction layer conversion           */
/*                           2003 chatserv                              */
/*      http://www.nukefixes.com -- http://www.nukeresources.com        */
/************************************************************************/

if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

global $prefix, $db;

$a = 1;
$result = $db->sql_query("SELECT lid, date, title FROM ".$prefix."_downloads_downloads ORDER BY date DESC LIMIT 0,10");
while ($row = $db->sql_fetchrow($result)) {
    $lid = intval($row['lid']);
    $title = stripslashes($row['title']);
    $title2 = ereg_replace("_", " ", $title);
    $content .= "<strong><big>&middot;</big></strong>&nbsp;$a: <a href=\"modules.php?name=Downloads&amp;d_op=viewdownloaddetails&amp;lid=$lid&amp;title=$title\">$title2</a><br>";
    $a++;
}

?>


NOTE you may need to change this part of the code to reflect your nuke version or patch level.
Code:
if ( !defined('BLOCK_FILE') ) {

    Header("Location: ../index.php");
    die();
}

_________________
Scott Johnson MIS Ubuntu/Linux 11.10 
View user's profile Send private message Visit poster's website
SpaceMonkey
PostPosted: Sun Sep 04, 2005 11:57 pm Reply with quote

Thanks, I'll try it later. Smile
 
SpaceMonkey
PostPosted: Sun Sep 11, 2005 1:56 am Reply with quote

Fantastic! Worked perfectly.. Downloads seem to be what everyone is really interested in on my site. Great to present them in such an obvious block.. Smile
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...

View next topic
View previous topic
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 can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©