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
Not tested it, it should work with very minor modification. (TABLE_PREFIX is no longer required).
Hi,

I had this modification working on my site fine, but i moved my site to a new host.
I uploaded the files and dumped the database on my new host. (I also changed the url's and other settings to reflect to the new host's settings)

But on the index page i get this error on the top of the page:

Warning: Cannot modify header information - headers already sent by (output started at /home/*****/public_html/mybb-hungary/index.php:3) in /home/****/public_html/mybb-hungary/forum/inc/functions.php on line 1216

Warning: Cannot modify header information - headers already sent by (output started at /home/*****/public_html/mybb-hungary/index.php:3) in /home/*****/public_html/mybb-hungary/forum/inc/functions.php on line 1216

Warning: Cannot modify header information - headers already sent by (output started at /home/****/public_html/mybb-hungary/index.php:3) in /home/*****/public_html/mybb-hungary/forum/inc/functions.php on line 1216
Could you either post here, or PM me, the contents of your "index.php" file?
Thanks, PM sent.
I tried it with 1.4 and it doesn't work Haven't really looked into changing it around to see if there is away to make it work.
No one said it would work on MyBB1.4.

Edit:
With removing TABLE_PREFIX. from the queries it should work.
It's very simple code, and as LeX- said, removing the TABLE_PREFIX from the queries (since it's no longer needed for 1.4) should make it work.
(2008-07-05, 01:23 AM)MrDoom Wrote: [ -> ]It's very simple code, and as LeX- said, removing the TABLE_PREFIX from the queries (since it's no longer needed for 1.4) should make it work.

I know its simple so it would be instead of
<?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> - 
                Posted: {$date} {$time} by <a href=\"{$forumpath}member.php?action=profile&uid={$row2['uid']}\">{$row2['username']}</a><br />");
            echo("{$message}<br /><br />");
            echo("Replies (<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['replies']}</a>)<br /><hr />");
        }
    }
    else
    {
        echo 'Nothing to display.';
    }

?>

it should be like this right
<?php
    
    $query = $db->simple_select('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('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> - 
                Posted: {$date} {$time} by <a href=\"{$forumpath}member.php?action=profile&uid={$row2['uid']}\">{$row2['username']}</a><br />");
            echo("{$message}<br /><br />");
            echo("Replies (<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['replies']}</a>)<br /><hr />");
        }
    }
    else
    {
        echo 'Nothing to display.';
    }

?>
Unless anything else has changed, yes.
yeah that works.
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