Hyper
Active Member
با سلام
براي نمايش آخرين موضوعات ارسالي در انجمن ميتونيد از اين ساختار استفاده كنيد :
مرحله اول :
فايلي بنام scroll.php ساخته و كد زير را در آن درج كنيد
مواردي كه قابل تغيير هستند :
تعداد موضوعات جديدي كه نمايش داده ميشود
جهت حركت scroll
توصيه ميشود تنها از UP يا DOWN استفاده نماييد
آدرس مربوطه كه حتما بايد به تناسب آدرس خودتون تغيير پيدا كند
خوب حالا فايل scroll.php رو در فهرست اصلي انجمن كپي كنيد
مرحله دوم :
فايل index.php رو گشوده و در انتهاي فايل كد زير رو بيابيد :
اين دستور را قبل از آن اضافه كنيد :
حالا با گشودن صفحه اول تغييرات را خواهيد ديد ...
( براي سهولت كار فايل رو ضميمه كردم ، ميتونيد دريافت كنيد )
موفق باشيد
براي نمايش آخرين موضوعات ارسالي در انجمن ميتونيد از اين ساختار استفاده كنيد :
مرحله اول :
فايلي بنام scroll.php ساخته و كد زير را در آن درج كنيد
PHP:
<?php
// Basic Configuration
// How Many Topics you want to display?
$topicnumber = 10;
// Scrolling towards up or down?
$scroll = "up";
// Change this to your phpBB path
$urlPath = "http://www.pptforum.com/forum";
// Database Configuration (Where your phpBB config.php file is located
include config.php;
// Connecting & Selecting Databases
$table_topics = $table_prefix. "topics";
$table_forums = $table_prefix. "forums";
$table_posts = $table_prefix. "posts";
$table_users = $table_prefix. "users";
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");
// Perform Sql Query
$query = "SELECT t.topic_poster,t.topic_views,t.topic_replies,t.topic_id, t.topic_title, t.topic_last_post_id,
t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username ,f.forum_name
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
WHERE t.topic_id = p.topic_id AND
f.forum_id = t.forum_id AND
t.topic_status <> 2 AND
t.forum_id <> 30 AND
t.forum_id <> 41 AND
p.post_id = t.topic_last_post_id AND
p.poster_id = u.user_id
ORDER BY p.post_id DESC LIMIT $topicnumber";
$result = mysql_query($query) or die("Query failed");
// Outcome of the HTML
// Be carefull when you edit these!
print "<marquee dir="rtl" align="center" id="recent_topics" behavior="scroll" direction="$scroll" height="200" width="100%" scrolldelay="100" scrollamount="2" onMouseOver="stop()" onMouseOut="start()">";
print "<div align="center">";
print "<table width="99%" cellpadding="5" cellspacing="1" border="0" class="forumline">";
print "<th width="35%" colspan="1">موضـــــــــوع</th>";
print "<th width="30%" colspan="1">انجمـــــــــن</th>";
print "<th width="10%" colspan="1">بازديــدهــا</th>";
print "<th width="10%" colspan="1">پاسخـــها</th>";
print "<th width="15%" colspan="1">توســـط</th>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$forum_no = $row["forum_id"];
echo
"<tr valign=middle class="row1">
<td class="row1"><font face="Tahoma" size="1">
<a href="$urlPath/viewtopic.php?p=$row[topic_last_post_id]#$row[topic_last_post_id]">
<span style="text-decoration: none">" . $row["topic_title"] .
"</span></a></td></font></b><td class="row2">
<font color="#000000">
<$urlPath/viewtopic.php?p=$row[topic_last_post_id]#$row[topic_last_post_id]>" . $row["forum_name"] .
"</td><td class="row1" align="center"><font face="Tahoma" size="1"><font color="#C0C0C0">" .
"</span></a></font></b>
<font color="#000000">
<$urlPath/viewtopic.php?p=$row[topic_last_post_id]#$row[topic_last_post_id]>" . $row["topic_views"] .
"</td><td align="center" class="row2"><font face="Tahoma" size="1"><font color="#C0C0C0">" .
"</span></a></font></b>
<font color="#000000">
<$urlPath/viewtopic.php?p=$row[topic_last_post_id]#$row[topic_last_post_id]>" . $row["topic_replies"] .
"</td><td align="center"><font face="Tahoma" size="1"><font color="#C0C0C0">" .
"</span></a></font></b>
<a href="$urlPath/profile.php?mode=viewprofile&u=$row[user_id]">" . $row["username"] .
"</td><font face="Tahoma" size="1"><font color="#C0C0C0">" .
"</tr></font>";
}
print "<table cellSpacing=0";
print "</table></div></marquee>";
// Free Result
mysql_free_result($result);
// Close the Connection
mysql_close($link);
?>
PHP:
$topicnumber = 10;
PHP:
$scroll = "up";
توصيه ميشود تنها از UP يا DOWN استفاده نماييد
PHP:
$urlPath = "http://www.pptforum.com/forum";
آدرس مربوطه كه حتما بايد به تناسب آدرس خودتون تغيير پيدا كند
خوب حالا فايل scroll.php رو در فهرست اصلي انجمن كپي كنيد
مرحله دوم :
فايل index.php رو گشوده و در انتهاي فايل كد زير رو بيابيد :
PHP:
//
// Generate the page
//
$template->pparse(body);
PHP:
include($phpbb_root_path . scroll..$phpEx);
حالا با گشودن صفحه اول تغييرات را خواهيد ديد ...
( براي سهولت كار فايل رو ضميمه كردم ، ميتونيد دريافت كنيد )
موفق باشيد