Topic: Getting my custom function to display correctly
So I am making a website for my World of Warcraft guild to celebrate finally killing C'Thun and marking us as one of the better guilds in the game and commemorating our entry into Naxx. I chose punBB for the site because it is easy to customize and it dosent carry alot of the junk of a normal forum.
Now to buisness, I used Connorhd's mini portal to make the front page, why re-invent the wheel, and on the side bar they want a box that displays the recent loot that our guild has gotten out of Naxx. So I wrote up a script to get the loot from the EQDKP database and display it on the side, everything works and all but It dosent display in the box, it is just up in the top part of the page.
As I'm kind of new with punBB I went off how Connorhd did the users online sidebar display when I was putting in the function and how to call it in the tpl file. If someone could look at what I coded and see if there are any obvious errors that are making it mess up it would be great.
you can see the problem at http://www.hackvoid.com/mentality thats where I am building it at
Ok, here is the function for functions.php
function recent_loot()
{
if(!function_exists(imp_rec_item_drop))
{
function imp_rec_item_drop()
{
global $eqdkp;
$eqdkp = @mysql_pconnect('localhost', 'steven_xxxx', 'xxxx');
if(!$eqdkp)
{
die('No data connection');
}
mysql_select_db('steven_xxxx');
$sql = "SELECT * FROM `eqdkp_items` ORDER BY `item_date` DESC LIMIT 0, 10";
$results = mysql_query($sql);
$num_results = mysql_affected_rows();
for($i =0; $i<$num_results; $i++)
{
$row = mysql_fetch_array($results);
$itemz = "[item]".stripslashes($row['item_name'])."[/item]<br>";
$itemz = itemstats_parse($itemz);
echo $itemz;
}
mysql_close($eqdkp);
}
}
return imp_rec_item_drop();
}
Here is the part in header.php
$tpl_main = str_replace('<pun_loot>','<div class="inbox">'."\n\t\t\t". recent_loot()."\n\t\t".'</div>', $tpl_main);
Here is the part in main.tpl
<div class="block">
<h2 class="block2"><span>Recent Loot</span></h2>
<div class="box">
<pun_loot>
</div>
</div>