можно все скопом, можно разбивая по темам, желательно с возможностью настройки колличества выводимых постов

может есть у кого такое?
Код: Выделить всё
## MOD Title: Topic Extraction
## MOD Author: clericvash < liamdawe@gmail.com > (Liam Dawe) http://www.vashvision.com
## MOD Description: This mod will enable you to grab posts from any forum and display them on your website. Useful for news, articles, shoutbox, latest topic links etc.
Код: Выделить всё
$quote = $lang['Quote'];
$code = $lang['Code'];
$wrote = $lang['wrote'];
$post_text = preg_replace('/\[quote[\:1]*\:[0-9a-z]+="([^"]*)".*?\]/si', "\\1 $wrote >>\n", $post_text);
$post_text = preg_replace('/\[quote[\:1]*\:[0-9a-z]+\]/si', "$quote >>\n", $post_text);
$post_text = preg_replace('/\[\/quote[\:1]*\:[0-9a-z]+\]/si', "\n<< $quote\n", $post_text);
$post_text = preg_replace('/\[code[\:1]*\:[0-9a-z]+\]/si', "\n$code >>\n", $post_text);
$post_text = preg_replace('/\[\/code[\:1]*\:[0-9a-z]+\]/si', "\n<< $code\n", $post_text);
Код: Выделить всё
<?php
// Database information
$db_host = "127.0.0.1";
$db_user = "*******";
$db_pass = "********";
$database = "*********";
// Connect to the database
mysql_pconnect($db_host,$db_user,$db_pass);
mysql_select_db($database);
// Posts information
$forum = "23";
// Select the topic information from the correct forum and set it to $grab_topics
$grab_topics = mysql_query("select * from djforum_topics where forum_id = '{$forum}' order by topic_id desc");
// Grab the information using an array and set it to $echo_topic
while ($echo_topic = mysql_fetch_array($grab_topics))
{
// Select the post information from the correct forum and set it to $grab_posts
$grab_posts = mysql_query("select * from djforum_posts where forum_id = '{$forum}' and topic_id = '{$echo_topic['topic_id']}' limit 5");
// Grab the information using an array and set it to $echo_post
while ($echo_post = mysql_fetch_array($grab_posts))
{
// Now get the post_text using the post_id were looking at and sort it info $grab_posts_text
$grab_posts_text = mysql_query("select * from djforum_posts_text where post_id = '{$echo_post['post_id']}'");
// Grab the information using an array and set it to $echo_text
while($echo_text = mysql_fetch_array($grab_posts_text))
{
// Find the user the posted
$find_user = mysql_query("select * from djforum_users where user_id = '{$echo_post['poster_id']}'");
// Sort this users info into array for the post
while ($echo_user = mysql_fetch_array($find_user))
{
// Replace new lines with line breaks
$echo_text = str_replace("\n","<br />",$echo_text);
// Now print out the post!
echo "
<strong>{$echo_text['post_subject']}</strong> от {$echo_user['username']}
<br />
<br />
{$echo_text['post_text']}
<br />
<br />
";
}
}
}
}
?>