درخواست آخرین ارسالهای انجمن

salehkhan

تازه وارد
سلام . میشه یکی بهم بگه من چطوری میتونم آخرین ارسالهای انجمن رو درون سایت قرار بدهم دقیقا مثل تصویر زیر :

anjomanlost.png


 

mahdiali35

کاربر عضو
آخرین ارسالهای چه سیستمی رو در چه سیستمی میخاید نمایش بدید ؟!

 

salehkhan

تازه وارد
میخوام آخرین ارسالهای انجمن mybb را در یک صفحه html خالی نشون بدم به عنوان home Page اصلی سایت مانند تصویر زیر :

anjomanlost.png


حالا اگه این هم نشد حداقل یک راهنمایی کنید چطوری میتونم با Rss بسازم ؟

 

mahdiali35

کاربر عضو
درود...

از کد زیر استفاده کنید تا آخرین پست ها رو در جای مورد نظرتون نمایش بده :

<style type="text/css">
#MTFloader{text-align:center;}
#MTForumBlock A:hover{text-decoration:underline;}
#MTForumBlock A{float:right;width:100%;height:100%;color:#666666;text-decoration:none;}
#MTForumBlock TABLE{width:100%;direction:rtl;}
#MTForumBlock TD{font-family:Tahoma;font-size:12px;color:#666666;}
#MTForumBlock TR.MTForumfirst,#MTForumBlock TR:hover{background-image:url(images/lastp/MTForumBlock_row_over.png);}
#MTForumBlock TR.MTForumfirst{background-image:url(images/lastp/MTForumBlock_row_over.png);}
#MTForumBlock TR:hover{background-image:url(images/lastp/MTForumBlock_row_over.png);}
#MTForumBlock TR{background-image:url(images/lastp/MTForumBlock_row.png);background-repeat:repeat-x;}
#MTForumBlockControl A{text-decoration:none;color:#666;float:right;width:49px;height:22px;line-height:20px;}
#MTForumBlockControl TABLE{height:22px;font-family:Tahoma;font-size:12px;color:#999999;}
#MTForumBlock{padding:0;}
#backff{background-color:#fff;}
.MTForumButton:hover{background-image:url(images/lastp/MTForumBlock_button.png);background-position:left;background-repeat:no-repeat;}
.MTForumButton{background-image:url(images/lastp/MTForumBlock_button.png);background-position:right;background-repeat:no-repeat;text-align:center;}
.MTForumanswer,.MTForumview,#MTFloader{text-align:center;}
.MTForumanswer{text-align:center;}
.MTForumlastusername{text-align:center;}
.MTForumlast{text-align:center;}
.MTForumposter{text-align:center;}
.MTForumrowtitle{padding-right:0;}
.MTForumtitle{text-align:center;}
.MTForumview{text-align:center;}
</style>

<?php
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';

echo '<div id="MTForumBlock">

<table width="100%">
<tr>
<th><font size="1" color="green" face="Tahoma">نام تاپیک</font></th>
<th><font size="1" color="green" face="Tahoma"> شروع کننده تاپیک</font></th>
<th><font size="1" color="green" face="Tahoma"> پاسخ ها</font></th>
<th><font size="1" color="green" face="Tahoma"> نمایش ها</font></th>
<th><font size="1" color="green" face="Tahoma"> آخرین نویسنده </font></th>
</tr>';

## CUSTOMIZE SETTINGS FOR YOUR SITE ##
$db_host = "localhost"; // Change this if your MySQL database host is different.
$db_name = "name_name"; // Change this to the name of your database.
$db_user = "user_user"; // Change this to your database username.
$db_pw = "pass_pass*"; // Change this to your database password.
$db_pre = "mybb_"; // Tables prefix
$url = "http://forums.site.com/"; // Change this to reflect to your forum's URL.
$limit = "10"; // Number of posts displayed.
$txtlimit = "200"; // This is the character limit.


#######################################

// Connecting to your database
mysql_connect($db_host, $db_user, $db_pw );
mysql_select_db($db_name);

mysql_query("SET NAMES latin1");
$thread_sql = mysql_query("SELECT tid,subject,username,lastposter,replies,views FROM ".$db_pre."threads order by lastpost DESC LIMIT $limit");

while($thread_get=mysql_fetch_array($thread_sql)) {
$replycount = $thread_get['replies'];
$views = $thread_get['views'];
$threadid = $thread_get['tid'];
$poster = $thread_get['lastposter'];
$title = $thread_get['subject'];
$postusername = $thread_get['username'];
$tid = $thread_get['tid'];
$lastpost = $thread_get['lastpost'];
$posts_sql = mysql_query("SELECT pid FROM ".$db_pre."posts WHERE tid=$tid ORDER BY pid DESC");
$getp=mysql_fetch_array($psql);
$pid = $posts_get['pid'];
if(strlen($title) > ($txtlimit-4)){
$title = substr($title,0,$txtlimit).'...';
}

echo "<tr width=\"100%\">


<td class=\"MTForumrowtitle\" width=\"45%\"><a target=\"_blank\" href=\"".$url."/thread-$tid-lastpost.html\"> $title</a></td>
<td class=\"MTForumlastusername\" width=\"20%\">$postusername</td>
<td class=\"MTForumanswer\" width=\"10%\">$replycount</td>
<td class=\"MTForumview\" width=\"10%\">$views</td>
<td class=\"MTForumlast\" width=\"25%\">$poster</td>
</tr>";
}

echo "</table>

</div>";


?>​
کد:
البته از خروجی xml هم میتونید استفاده کنید چون پلاگین فوق دسترسی ها رو بررسی نمیکنه و آخرین پستها رو در هر گروه و انجمنی رو نمایش میده

شاد باشید...

 
بالا