MyBB Community Forums

Full Version: Displaying News on 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
can`t any body help me ?!
my friends :
it is Necessary for me ! plz Help me !
Try this:

<?php
$forumpath = ".//"; // Path to your forums root directory (with trailing slash)
$limit = "10"; // The amount of annoucements to show

require $forumpath."inc/config.php";
mysql_select_db($config['database'], mysql_connect($config['hostname'], $config['username'], $config['password']));

$query = mysql_query("SELECT t.tid,t.subject,t.uid,t.username,t.dateline,t.replies,p.message,u.avatar FROM ".$config['table_prefix']."threads t LEFT JOIN ".$config['table_prefix']."posts p ON (t.tid = p.tid) LEFT JOIN ".$config['table_prefix']."users u ON (t.uid = u.uid) WHERE t.visible='1' AND t.closed NOT LIKE 'moved|%' AND p.replyto='0' ORDER BY dateline DESC LIMIT 0, ".$limit."") or die(mysql_error());
while($news = mysql_fetch_array($query))
{
	if(strlen($news['message']) > 50) {
        $news['message'] = substr($news['subject'], 0, 20);
        $news['message'] .= "...";
    }
    $date = gmdate("d-m-Y", $news['dateline']);
    $time = date("h:i A", $news['dateline']);
    if($news['replies'] == "1")
    {
        $replytext = "reply";
    }
    else
    {
        $replytext = "replies";
    }
    echo "<table cellpadding=\"0\" align=\"center\" style=\"border: solid 0px #000000;\" width=\"100%\" dir=\"rtl\">\n";
    echo "<tr><td dir=\"rtl\" style=\"border: solid 0px #000000;\"\"><a title=\"".$news['message']."\" href=\"showthread.php?tid=".$news['tid']."\">".$news['subject']."</a> | - <a href=\"member.php?action=profile&amp;uid=".$news['uid']."\">".$news['username']."</a> - ".$date." - ".$time." | - : ".$news['replies']." |</td></tr>\n";
    echo "</table><br />\n\n";
}
?>
[/quote]
tnx Tikitiki
but above code have 2 problem :
1- not show " new Replys to old thread " on the page and not move new replay topic to the first line of page.
2- not change poster username to new poster(Reply) username .
thank.
I've seen many codes in this thread.. I was wondering, which one is the best?
can you help me about Post: 104 !
Just for all of you that wanted to know, I've created a plugin that will allow you to show your news on the home page, with options like, what forum(s) to fetch it from, and how many to show. It will be release when MyBB 1.2 comes out
Thanks so much Smile, can't wait for it, Hope it works better than the code I took from portal.php
It parses MyCode, and it'll be much simplier if thats what your asking Toungue
Does anyone know where that tutorial went where it showed you how to intergrate mybboard into your main website? / subdirectorys?
0_o i remember seeing it a while back and i dont know where it is..
Pages: 1 2 3 4 5 6 7 8 9 10 11 12