MyBB Community Forums

Full Version: Include last 5 news on other site
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello.

I need include my last example 5 news on other site. I looking any mod/script.

example;
Forum news: http://forum.querana.com/ (LAST NEWS TEST)

Show last 5 news in index.php http://querana.com/


Thanks for help.
you can use this method
(2016-02-20, 05:01 PM).m. Wrote: [ -> ]you can use this method

Thanks. I make example script.

<?PHP
error_reporting(E_ALL);
$db = mysql_connect('***', '***',  '***') or die ("Nie mogę się połšczyć!.");
mysql_select_db('***', $db) or die("Brak bazy danych!");
mysql_query("SET CHARSET latin2", $db);

$query = "SELECT COUNT(*) FROM mybb_posts WHERE (fid = '2') AND (replyto = '0')";
$result = @mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_NUM);
$count_rekords = $row[0];
//CONFIG!!
$podziel = '2'; //Ile newsów na stronie
$query = "SELECT tid, replyto, fid, subject, uid, username, dateline, message, visible FROM mybb_posts WHERE (fid = '2') AND (replyto = '0') ORDER BY tid DESC LIMIT {$podziel}";
$result = @mysql_query($query);
$num = mysql_num_rows ($result);
if ($num > 0)
{

  while  ($news = mysql_fetch_array($result, MYSQL_ASSOC ))
  {
$autor = $news['username'];
$temat = $news['subject'];
$message = $news['message'];
$date_day = date("j", $news['dateline']);
$date_mounth = date("m", $news['dateline']);
$date_year = date("Y", $news['dateline']);
$time = date("H:i", $news['dateline']);
   switch ($date_mounth) {
         case '01': $date_mounth = 'Stycznia'; break;
         case '02': $date_mounth = 'Luty'; break;
         case '03': $date_mounth = 'Marzec'; break;
         case '04': $date_mounth = 'Kwiecień'; break;
         case '05': $date_mounth = 'Maj'; break;
         case '06': $date_mounth = 'Czerwiec'; break;
         case '07': $date_mounth = 'Lipiec'; break;
         case '08': $date_mounth = 'Sierpień'; break;
         case '09': $date_mounth = 'Wrzesień'; break;
         case '10': $date_mounth = 'Październik'; break;
         case '11': $date_mounth = 'Listopad'; break;
         case '12': $date_mounth = 'Grudzień'; break;
           default: $date_mounth = 'Błąd!!!'; break;
       }


	   
	     $main_content .= '			
		<div class="NewsHeadline">
			<b>'.$date_day.' '.$date_mounth.' '.$date_year.'r.</b> - <i>'.stripslashes($temat).'</i><hr>
		</div>


<table style="clear:both" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr>
<td style="padding-left:10px;padding-right:10px;">


'.stripslashes($message).'

<br>
</td>
</tr></tbody></table><br><br>

';

}
  mysql_free_result ($result);
}
	   
	   
?>

How to transfer bbcode to cms? Live demo:
http://forum.querana.com/thread-7.html
and
http://querana.com/
^ see this post
(2016-02-20, 06:01 PM).m. Wrote: [ -> ]^ see this post

Thanks 4 help. I slove problem. I marked use HTML in MyBB post (laziness) Toungue
^ well, if you want to enable html, I'd suggest to do it for few privileged Staff (see HTML in Posts plugin)
(2016-02-20, 06:10 PM).m. Wrote: [ -> ]^ well, if you want to enable html, I'd suggest to do it for few privileged Staff (see HTML in Posts plugin)

Awesome, work Big Grin thanks