PDA


View Full Version : Querys from other hacks


Acido
05-16-2004, 07:55 PM
Hi

I'm having problems porting anothers hacks like: Quote of the day, top X posters, New X members.

I found very cool the way to create new módules. It's very easy. But i cant find where insert the necesary querys for thoses hacks.

In Adv_index.php i put querys like this:
// ### TOP STATS ########################################
$limit = 5;
$top_stats = array();
// TOP POSTERS
$top_posters = $DB_site->query("SELECT * FROM ".TABLE_PREFIX."user ORDER BY posts DESC LIMIT 10");
while($top_poster = $DB_site->fetch_array($top_posters))
{
eval('$top_stats[\'top_posters\'] .= "' . fetch_template('top_posters') . '";');
}
unset($top_poster);
$DB_site->free_result($top_posters);
// NEWEST MEMBERS
$newest_members = $DB_site->query("SELECT * FROM ".TABLE_PREFIX."user ORDER BY userid DESC LIMIT $limit");
while($newest_member = $DB_site->fetch_array($newest_members))
{
eval('$top_stats[\'newest_members\'] .= "' . fetch_template('newest_members') . '";');
}
unset($newest_member);
$DB_site->free_result($newest_members);

At the end of the adv_index.php, and the modules ran perfectly

But now i'm pretty confused...
Can someone clarify me this issue?

Brian
05-17-2004, 01:56 PM
The easiest way would be to split that into two files with the following content:



<?php

// ### TOP STATS ########################################
$limit = 5;
$top_stats = array();
// TOP POSTERS
$top_posters = $DB_site->query("SELECT * FROM ".TABLE_PREFIX."user ORDER BY posts DESC LIMIT 10");
while($top_poster = $DB_site->fetch_array($top_posters))
{
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('top_posters') . '";');
}
unset($top_poster);
$DB_site->free_result($top_posters);
?>



<?php
// NEWEST MEMBERS
$newest_members = $DB_site->query("SELECT * FROM ".TABLE_PREFIX."user ORDER BY userid DESC LIMIT $limit");
while($newest_member = $DB_site->fetch_array($newest_members))
{
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('newest_members') . '";');

}
unset($newest_member);
$DB_site->free_result($newest_members);
?>


Upload those files to your forum/modules folder, and then add the modules through your Admin CP (be sure to select the correct file for each), and that should be it. :)

Acido
05-17-2004, 11:33 PM
Big thanx Brian

Now i'll put the new module in the Addon Modules, Hacks, & Modifications (http://www.vbadvanced.com/forum/forumdisplay.php?f=26) forum.

;)