Current time: 03-22-2010, 01:24 PM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 3 Votes - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Basic Site-Forum Integration
05-30-2008, 11:22 AM
Post: #61
RE: [Tutorial] Basic Site-Forum Integration
I've inserted the code for the user control panel thingy. The code works, BUT!, I get this error:

Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /home/manne/public_html/p_index.php on line 10

I checked what is on line 10 which is the following:
Code:
define("IN_MYBB", 1);

It's part of a code that's being used to retreive posts as news items on my website.

So the main website code looks like this:
Code:
<head>
<script>
function submitted()
{
setTimeout("refresh()",6000);
}
function refresh()
{
var sURL = unescape(window.location.pathname);
window.location.href = sURL;
}
</script>

<link rel="stylesheet" href="tangodown.css">

etc. etc. until
[/head]
<?php
$rel = "forum/"; // The directory to your forum--relative to this file's location; include ending slash
chdir($rel);
define('IN_MYBB', 1);
require("./global.php");
?>

Now I'm using this together with a different news post-retreive thing which uses the following code (p_index.php):

Code:
<?php

    $fid = 2;
    $limit = 5;
    $forumpath = 'forum/';

    chdir($forumpath);
    define("IN_MYBB", 1);
    require('./global.php');
    require_once MYBB_ROOT."inc/class_parser.php";
    $parser = new postParser;
    chdir('../');
?>
<span class="forumtext">
<?php
    
    $query = $db->simple_select(TABLE_PREFIX.'threads', '*', "fid='{$fid}' ORDER BY tid DESC LIMIT {$limit}");
    if($db->num_rows($query) > 0)
    {
        while($row = $db->fetch_array($query))
        {
            $query2 = $db->simple_select(TABLE_PREFIX.'posts', '*', "pid='{$row['firstpost']}'");
            $row2 = $db->fetch_array($query2);
            
            $date = my_date($mybb->settings['dateformat'], $row2['dateline'], "", 1);
            $time = my_date($mybb->settings['timeformat'], $row2['dateline'], "", 1);

            $options = array(
                            'allow_html' => 'no',
                            'filter_badwords' => 'yes',
                            'allow_mycode' => 'yes',
                            'allow_smilies' => 'yes',
                            'nl2br' => 'yes',
                            'me_username' => 'yes'
                            );
            $message = $parser->parse_message($row2['message'], $options);
            echo("<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['subject']}</a> <br />");
        echo("Door <a href=\"{$forumpath}member.php?action=profile&uid={$row2['uid']}\">{$row2['username']}</a> op {$date}");
            echo("<br /><br />");
            echo("{$message}<br /><br />");
        echo("<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['replies']} Reacties</a>");
            echo("<hr />");
            echo("<br /><br />");
        }
    }
    else
    {
        echo 'Nothing to display.';
    }

?>

Could it be that the combination of these scripts create the error? I thought it might be because 2 times the code defines IN_MYBB but deleting one row doesn't work..
Find all posts by this user
Quote this message in a reply
08-30-2008, 12:20 PM (This post was last modified: 08-30-2008 12:22 PM by Savoy.)
Post: #62
RE: [Tutorial] Basic Site-Forum Integration
Can anyone help?
I have in root my portal (which i want to integrate with mybb) and in /forums/ i have mybb.

I put the
Code:
define("IN_MYBB", 1);
// set the path to your forums directory here (without trailing slash)
$forumdir = "/forums";

// end editing

$change_dir = "/forums";

if(!@chdir($forumdir) && !empty($forumdir))
{
    if(@is_dir($forumdir))
    {
        $change_dir = $forumdir;
    }
    else
    {
        die("\$forumdir is invalid!");
    }
}

require_once $change_dir."/global.php";
but when i print the $mybb->user i take:
Code:
Array ( [usergroup] => 1 [username] => [uid] => 0 [displaygroup] => 1 [lastvisit] => 1220098510 [ismoderator] => )

and of course nothing is working.
Find all posts by this user
Quote this message in a reply
08-30-2008, 07:10 PM (This post was last modified: 08-30-2008 07:10 PM by bombo.)
Post: #63
RE: [Tutorial] Basic Site-Forum Integration
is this also possible whit a forum in a http://forum.mysite.com url?
Find all posts by this user
Quote this message in a reply
10-12-2008, 05:41 AM
Post: #64
RE: [Tutorial] Basic Site-Forum Integration
can someone confirm if this works with 1.4? Smile Thanks!
Find all posts by this user
Quote this message in a reply
11-15-2008, 01:01 AM
Post: #65
RE: [Tutorial] Basic Site-Forum Integration
Can someone help me put newest member Today's top poster and Most popular forum into the stats bit,

so making

$user_result = mysql_query("SELECT COUNT(*) as count FROM ".$prfx."users");
$user_count = mysql_fetch_array($user_result);
$user_count = $user_count["count"];

for each one, im not sure how as im new to the mysql query stuff =[
Visit this user's website Find all posts by this user
Quote this message in a reply
11-23-2008, 03:34 PM
Post: #66
RE: [Tutorial] Basic Site-Forum Integration
*BUMP*

And other question,

should the login form one you press the login button change to list the change email, avatar ect?

Mine isnt doing this ;[
it just logs the user in and goes straight to the forum
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: