MyBB Community Forums

Full Version: Show more fids in homepage
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Using this code, it works but... how can i use more FIDs:

$fid = 5;

I want also the fid = 2;

How can i do?

<?php

    $fid = 5;
    $limit = 10;
    $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('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> -
                <b>Inviato:</b> {$date} <b>alle</B> {$time}. <br><br>
                <b>Autore:</b> <a href=\"{$forumpath}member.php?action=profile&uid={$row2['uid']}\">{$row2['username']}</a><br /><br>");
            echo("<b>Messaggio:</b><br> {$message}<br /><br />");
            echo("<b>Numero di risposte:</b> (<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['replies']}</a>)<br /><hr />");
        }
    }
    else
    {
        echo 'Nessuna Notizia.';
    }

?>

Moreover the IMG tag isn't show in the homepage.

I used this guide
First: No need to edit the core file for increasing the number of forum IDs on home page. It can easily be done through Admin CP.
Go to Admin CP > Configurations > Settings > Forum Home Options > and add the number of subforums to show on index listings.

Second: [IMG] will NOT be shown on index. However you can use <img src="http:domain.com/image.gif"> for displaying of Images on Index Templates.
But that isn't a subforum!

See here: http://habboplaza.netsons.org/forum/

I want use: News interne and News!

is that possible?
Sorry I can't understand,
What do you mean by
News interne and News
???

I saw their on your forum that these are two different forums on separate Categories.

Do you mean to 'Use these forums collectively' ?
No! On the home page http://habboplaza.netsons.org/
You can see that shows the thread of "News".
For do that i used that code.
Is possible to show also "News Interne" on the homepage?
If you mean to show this
Stanze elfiche 
Yesterday 06:16 PM
by Trinit
on your other forum like
News interne
News di HabboPlaza
then it is possible only when you copy those threads and move them to that forum.
Ah thank you Big Grin
Trinit, you just need to alter the query. Change this in your code:

$query = $db->simple_select('threads', '*', "fid='{$fid}' ORDER BY tid DESC LIMIT {$limit}");

to:

$query = $db->simple_select('threads', '*', "fid='X' OR fid='Y' ORDER BY tid DESC LIMIT {$limit}");

Changing X and Y to the FIDs of the forums you want to display news from. To add more, just simply do:

$query = $db->simple_select('threads', '*', "fid='X' OR fid='Y' OR fid='Z' OR fid='A' ORDER BY tid DESC LIMIT {$limit}");

Ghazal is wrong by telling you to move the threads.
Ps. Also using the html code, the img isn't show!
Ahh..! You want to show the news from the other forums.. My Mistake. I thought that you want to show 'threads/posts' in another forum aswell... Sorry...

For Image Tags: I provided the code earlier.
<img src="http://www.IMAGE_URL.com">

Change IMAGE_URL to your desired image URL
Pages: 1 2