MyBB Community Forums

Full Version: thread display on page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
announcements.php is simply your script, I just include() it in index.php...but okay...

Note: The only thing I modified was what $post echoes...changed the formatting a bit.

<?php

// Root Of Forum
$root = "forums";
// Posts To Show
$max = 4;
// Table Prefix
$prefix = "mybb_";
// Forum ID
$fid = 4; //Announcements

define('IN_MYBB', 1);
//chdir($root);
require "forums/global.php";

// Get Posts
$query = $db->query("SELECT * FROM ".$prefix."posts WHERE fid=$fid ORDER BY dateline DESC LIMIT 0,$max");
while($posts = $db->fetch_array($query))
{
//PostInfo
$tid = $posts['tid'];
$pid = $posts['pid'];
$subject = $posts['subject'];
$subject = str_replace("RE:","",$subject);
$date = date("H:i / d-m", $posts['dateline']);
$message = $posts['message'];

//UserInfo
$username = $posts['username'];
$uid = $posts['uid'];
require_once "inc/functions_user.php";
$link = build_profile_link($username, $uid);
//Posts
$post .= "<font size='4'><a href=\"{$root}showthread.php?tid={$tid}&pid={$pid}#pid={$pid}\">{$subject}</a></font><br />Posted by ".$link." on ".$date."<br /><p>{$message}</p><br />";

}

echo $post;

?>
is this code correct?
hello?
Pages: 1 2