1 (edited by Loa 2007-10-21 21:07)

Topic: Integration Problem [SOLVED]

Heya ppl!

Sneaking past this forum now once in a while. Really excited about punbb 1.3 mmm.

Well anyway my problem. I have like many integrated my forum into my site through the template file. The problem with my site is that I have dynamic menus (right managements etc.) that requires php files (header.php, footer.php). These I have in a "global" dir (../global/ seen from forum dir).

So first step was that you can't use php in main.tpl.. but there exist "<pun_include..."!!
Woopa.. so I created two files in "/include/user/" that looks like this and include them to the main.tpl.

<?php
include "../global/header.php";
?>

But as fast as I include something out of "forum main dir" there starts to happen alot of "spooky" things on the forum...

Anyone that perhaps knows why this occurs?

Re: Integration Problem [SOLVED]

Use PUN_ROOT and define it relative to that.

3

Re: Integration Problem [SOLVED]

Done this:

<?php
    require PUN_ROOT.'../global/footer.php';
?>

But doesnt work..

Re: Integration Problem [SOLVED]

What's the error you get?

5

Re: Integration Problem [SOLVED]

My "spooky" things are that some user info isnt read. Like style sheets arnt applied but only showing the standard one. If someone is moderator you can't choose what forums the person is moderator over cause the forum seems not to notice that the member is moderator.

Well I went through my code and started to comment out some stuff (all of it basically). So I noticed that the "errors" dissappeared when I commented out the include for this file:

<?php
$result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.$pun_user['last_visit'].' AND t.moved_to IS NULL') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

if($db->num_rows($result)) {
    $updated=true;
} else {
    $updated=false;
}
?>

Re: Integration Problem [SOLVED]

Mmm, could you paste a copy of your code?

7

Re: Integration Problem [SOLVED]

Smartys wrote:

Mmm, could you paste a copy of your code?

You get whatever you wan't Smartys.
But as fast as I don't include the previous code there are no problems.. so it should be there.. ^^

8 (edited by Loa 2007-10-21 20:20)

Re: Integration Problem [SOLVED]

Something I can't understand is that .. if I comment out the code I previously posted.. or empty the hole file I get the error.... so I get the error as soon as I include that file.

But I'm able to include other files without any problem that resides on exactly the same spot with a minor difference in filename...

Oh and the files have the exactly same user/group and rights..

Re: Integration Problem [SOLVED]

Could you provide a link to your forum?

10

Re: Integration Problem [SOLVED]

http://forum.avarice.se/

11 (edited by Loa 2007-10-21 20:45)

Re: Integration Problem [SOLVED]

So... now Im starting to feel that I should have tried a bit harder before posting here... well well..

I commented out code totally wildly around on the site... and now I have succeded to state the previously posted code bugg free.

It works..  but when running the following I get the bugg:

        <div class="frame">
            <div class="topic">Online List</div>
            <div id="text">
                <ul>
<?php
$db_users = $db->query("SELECT * FROM forum_online Where idle=\"0\" ORDER BY ident") or error('Unable to fetch the pages', __FILE__, __LINE__, $db->error());

if($db->num_rows($db_users)) {
    while($user = $db->fetch_assoc($db_users)) {
        if($user['user_id']!="1") {
            echo "            <li>".$user['ident']."</li>\n";
        }
    }
}
?>
                </ul>
            </div>
        </div>

.. well that didnt post as a beauty.

Well what it does is that it gets the users logged in a prints it in a list... thats it.. and this is truely the error..somewhere here..

12

Re: Integration Problem [SOLVED]

So now I should perhaps tell why Im rerouting the errors wildly..

I have a navigation bar for my hole page.. so I have a loop that goes through all pages that is stored in the database and checks in their root folder ("../forum/", "../chat", etc) after a file that is called "ava_update.php". If the file exists it will get included and then I check a variable $updated if its true or not and then prints out a class to the link in the menu to highlight it if $updated==true.

So first I thought it was the ava_update.php file for the forum. But it wasnt and I didnt think about the chat page ava_update.php that was the real reason.

So its the chats "ava_update.php" and my "online list" files that is being included that causes my errors...

13

Re: Integration Problem [SOLVED]

my chat "ava_update.php" that is messing around...

<?php
if($ava_page['name'] != "shoutbox") {
    //H?mta tidpunkten som personen l?ste senast
    $db_users = $db->query("SELECT * FROM avarice_shoutbox_update WHERE id='".$pun_user['id']."'") or error('Unable to fetch the pages', __FILE__, __LINE__, $db->error());
    if($db->num_rows($db_users)) {
        while($user = $db->fetch_assoc($db_users)) {
            $lastcheck = strtotime($user["date"]);
        }
    } else {
        $lastcheck = date("Y-m-d G:i:s");
    }

    $updated = false;
    $db_messege = $db->query("SELECT * FROM avarice_shoutbox ORDER BY date desc") or error('Unable to fetch the pages', __FILE__, __LINE__, $db->error());

    //Kollar om det finns nya meddelanden i shoutboxen.
    if($db->num_rows($db_messege)) {
        while(($messege = $db->fetch_assoc($db_messege)) && (!$updated)) {
            if($lastcheck<strtotime($messege['date'])) {
                $updated = true;
            }
        }
    }
}
?>

14

Re: Integration Problem [SOLVED]

Problem Solved!!!


So... I can't use variables that is called "user"..... hm.. what a pain in the xD

Thanks for all support Smartys!!! Greatly grateful!