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
Why if I put this code into my template, it convert all the code into
 
?
Image BB codes won't work on my News display for some reason.
(2009-09-08, 02:56 AM)Ooka Wrote: [ -> ]Image BB codes won't work on my News display for some reason.

Solution on previous pages:

(2008-12-31, 11:58 AM)Craigw Wrote: [ -> ]Has anyone found the cause of the [IMG] tag not parsing on the news page.

nvm finally found it Smile, just add this line on the array options

'allow_imgcode' => '1'
Oh, I must have looked over it on accident, I actually did look, lol.
Can someone confirm that this tutorial will still work in the latest version of MyBB, before I try and do this tutorial? Thanks in advance.

I just tried it; however I am receiving the following error on my home page where the news should be displayed:

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
    1146 - Table 'mybb_board.mybb_mybb_threads' doesn't exist
Query:
    SELECT * FROM mybb_mybb_threads WHERE fid='6' ORDER BY tid DESC LIMIT 5 

I have followed the tutorial by the letter. Are there any suggestions of why this is happening?
Nevermind. I have fixed the problem.
If anyone is interested this is how I have done mine.

<?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', '*', "tid='{$row['tid']}' LIMIT 5");
            $row2 = $db->fetch_array($query2);
            
            $date = my_date($mybb->settings['dateformat'], $row2['dateline'], "", 5);
            $time = my_date($mybb->settings['timeformat'], $row2['dateline'], "", 5);

            $options = array(
                            'allow_html' => 'yes', 
							'allow_imgcode' => '1',
                            'filter_badwords' => 'yes', 
                            'allow_mycode' => 'yes', 
                            'allow_smilies' => 'yes', 
                            'nl2br' => 'yes', 
                            'me_username' => 'yes'
                            );
            $message = $parser->parse_message($row2['message'], $options);
            
            echo("<h3><a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['subject']}</a></h3> 
                {$date}, {$time} by <a href=\"{$forumpath}member.php?action=profile&uid={$row2['uid']}\">{$row2['username']}</a><br />");
            echo("<p>{$message}</p>");
            echo("<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['replies']} Comments</a> | 
			<a href=\"{$forumpath}newreply.php?tid={$row['tid']}\">Write Comment</a><br />");
        }
    }
    else
    {
        echo 'Nothing to display.';
    }

?>

Does anyone know how to get the date displayed as:

September 14, 2009 instead of 09-14-2009.
(2009-09-14, 10:01 AM)goombastic Wrote: [ -> ]Nevermind. I have fixed the problem.
If anyone is interested this is how I have done mine.

<?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', '*', "tid='{$row['tid']}' LIMIT 5");
            $row2 = $db->fetch_array($query2);
            
            $date = my_date($mybb->settings['dateformat'], $row2['dateline'], "", 5);
            $time = my_date($mybb->settings['timeformat'], $row2['dateline'], "", 5);

            $options = array(
                            'allow_html' => 'yes', 
							'allow_imgcode' => '1',
                            'filter_badwords' => 'yes', 
                            'allow_mycode' => 'yes', 
                            'allow_smilies' => 'yes', 
                            'nl2br' => 'yes', 
                            'me_username' => 'yes'
                            );
            $message = $parser->parse_message($row2['message'], $options);
            
            echo("<h3><a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['subject']}</a></h3> 
                {$date}, {$time} by <a href=\"{$forumpath}member.php?action=profile&uid={$row2['uid']}\">{$row2['username']}</a><br />");
            echo("<p>{$message}</p>");
            echo("<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['replies']} Comments</a> | 
			<a href=\"{$forumpath}newreply.php?tid={$row['tid']}\">Write Comment</a><br />");
        }
    }
    else
    {
        echo 'Nothing to display.';
    }

?>

Does anyone know how to get the date displayed as:

September 14, 2009 instead of 09-14-2009.

this is how i did it to show the complete date

                   $date = my_date($mybb->settings['dateformat'], $row2['dateline'], "", 1);
                $time = my_date($mybb->settings['timeformat'], $row2['dateline'], "", 1);
(2009-09-22, 09:48 PM)Venom Wrote: [ -> ]this is how i did it to show the complete date

                   $date = my_date($mybb->settings['dateformat'], $row2['dateline'], "", 1);
                $time = my_date($mybb->settings['timeformat'], $row2['dateline'], "", 1);

That would surely depend on how you have the global date format set-up on your forum?
I begin aswell errors.

_________________
Swing sets
Is it possible to link to an external forum?

Since there is a main website with a forum; and there are other smaller websites on a different server. Is it possible to still show the news from a forum on the websites on the other server?
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