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
Is your forums database in UTF8 and do you have the UTF8 meta information in the page you are loading this news into's header section of HTML?
MrDoom Wrote:Is your forums database in UTF8 and do you have the UTF8 meta information in the page you are loading this news into's header section of HTML?

Whoops.....Big Grin yes that was the problem. Thanks

But I have another problem. The fid is set to 2, but it draws post from another forum.

Also, is it possible to display posts from a particular topic, not a forum?

Thanks
Erm weird. Could you either post or PM me a link to your forum and a link to your news page?
It's on localhost
Hmmm ..... now it works fine. Smile

But I still have this question:
Is it possible to display posts from a particular topic, not a forum?
This should work but I haven't tested it:
<?php
    $tid = 2;
    $forumpath = 'forum/';

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

<?php
    $query = $db->simple_select(TABLE_PREFIX.'posts', '*', "tid='{$tid}'");
    if($db->num_rows($query) > 0)
    {
        while($row = $db->fetch_array($query))
        {            
            $date = my_date($mybb->settings['dateformat'], $row['dateline'], "", 1);
            $time = my_date($mybb->settings['timeformat'], $row['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($row['message'], $options);
            
            echo("<a href=\"{$forumpath}showthread.php?tid={$tid}&amp;&pid={$row['pid']}#pid{$row['pid']}\">{$row['subject']}</a> - 
                Posted: {$date} {$time} by <a href=\"{$forumpath}member.php?action=profile&uid={$row['uid']}\">{$row['username']}</a><br />");
            echo("{$message}<br /><br /><hr />");
        }
    }
    else
    {
        echo ('Nothing to display.');
    }
?>
When i post stuff on my board it says "nothing to display" on my home page.How can i get it to display what i am posting on my forum board?
Have you set it up with a valid forum ID (fid)?
i have it set to 1 is that correct
Sorry about that.i found the forum ID.You were right i had the wrong number.Thanks so much for your help. Big Grin[/align]
Anyone tried this for 1.4?
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