Not sure what is in those include files that this may require. And the fact that it declares its own database connection, it would need to be converted to use phpNuke's database connection and abstraction layer. It would take some work to accomplish
hmmm like how much work? all thats in includes file is db username and pw
Fireboar Corporal
Joined: Dec 01, 2006
Posts: 64
Posted:
Wed Dec 20, 2006 10:02 am
Here's how:
Code:
<?php
// Make sure people don't try and access it directly
if ( !defined('BLOCK_FILE') ) {
die("Illegal Block File Access");
}
global $db;
// Firstly set up the table to start it off:
$content .= " </strong><strong> </strong></p>\n <div align=\"center\">\n <table width=\"169\" border=\"1\" align=\"center\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#006699\">\n";
// Now loop through each of the 4 categories because I'm too lazy to write out the same code 4 times and this way works just the same.
for ($i=1; $i<=4; $i++)
{
// What are we using? Set up the bits that change with each one:
if ($i = 1) {
$contenttype = "POINTS";
$contenttype_lower = "points";
$abbr = "PPG";
$abbr_lower = "ppg";
}
if ($i = 2) {
$contenttype = "REBOUNDS";
$contenttype_lower = "rebounds";
$abbr = "RPG";
$abbr_lower = "ppg";
}
if ($i = 3) {
$contenttype = "ASSISTS";
$contenttype_lower = "assist";
$abbr = "APG";
$abbr_lower = "ppg";
}
if ($i = 4) {
$contenttype = "BLOCKS";
$contenttype_lower = "block";
$abbr = "BPG";
$abbr_lower = "ppg";
}
// SQL query...
if (!$result = $db->sql_query("SELECT name as n, sum(".$contenttype_lower."/gps) as ".$abbr_lower." FROM nl_fullstats GROUP BY n ORDER BY ".$abbr_lower." DESC LIMIT 5")) die (mysql_error());
That confusing (though not as long as the one we started with) stream of code should (if I haven't made any errors) come up with what you had there, only in block form. Save it as "blocks/block-Something" (replacing "Something" with whatever you want) and try it out, see if it'll work. On a side note, the database will have to be the same one as the phpnuke database.
_________________ http://www.fantasy-pc.com/ - PHP-Nuke website with a growing community where you can talk about anything.
Want a version of PHP-Nuke with all the bells and whistles removed? PHP-Nuke Lite is for you!
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