no backups? Definitely should back up your db if you don't know what you're doing and are gonna be messing with it.

Ok, I think thats the proper format. If not tell me what I'm doing wrong so I can fix it smile

##
##
##        Mod title:  Drop-Down Menu Mod
##
##      Mod version:  1.0
##   Works on PunBB:  1.2.x
##     Release date:  7/04/07
##           Author:  Steven "Aonxe" Holder
##
##      Description:  This mod shows how to add a drop down menu system to a 
##                    PunBB forum.
## 
##   Affected files:  functions.php
##                    header.php
##                    main.tpl
##
##        New files:  include/template/drop.css
##
##       Affects DB:  No
##
##            Notes:  This mod was written by Steven Holder and uses a
##                    drop down menu found at CSSPlay to show a dynamic
##                    drop down menu for PunBB. Only tested with 1.2.15.
##
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

This mod allows you to add a drop down menu to get an effect simmilar to this:

http://www.hackvoid.com/punlink.jpg

http://www.punres.org/desc.php?pid=418

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>