MyBB Community Forums

Full Version: Displaying News on your homepage
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
It's what was posted on here, but in reality it's the third line.

<?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))
If that's all that's on the page, it won't know what $db is since you need to include the MyBB global.php first.

<?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('../');
?>
It's in my Joomla! index.php already. I'm running it in an iFrame, should I have put the code in there? I'll try that.

EDIT: That solved it, but I needed to change something:
<?php

    $fid = 5;
    $limit = 5;
    $forumpath = './';

    chdir($forumpath);
    define("IN_MYBB", 1);
    require('./global.php');
    require_once MYBB_ROOT."inc/class_parser.php";
    $parser = new postParser;
    chdir('../');
?>

I needed to add a "." before the slash on the seventh line.
MrDoom, you have any idea how to make a logout link? LOLs
But of course Toungue

echo("<a href=\"{$forumpath}member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}\">Logout</a>");
MrDoom Wrote:But of course Toungue

echo("<a href=\"{$forumpath}member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}\">Logout</a>");
:mad: can't get it to work...can i post my file here for you to have a look?
Sure.
Thanks alot...Shall attach it here...

[attachment=8363]
Line 129 - Change:
<?php echo $mybb->user["sid"]; ?>
To:
<?php echo $mybb->user['logoutkey']; ?>
Parse error: syntax error, unexpected T_VARIABLE in /home/ys/public_html/forum_loginbox.php on line 1 Sad
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33