نمايش آخرين موضوعات ( Scroll.php ) نسخه برتر

Hyper

Active Member
با سلام

براي نمايش آخرين موضوعات ارسالي در انجمن ميتونيد از اين ساختار استفاده كنيد :

مرحله اول :

فايلي بنام 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";
جهت حركت scroll
توصيه ميشود تنها از 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);

حالا با گشودن صفحه اول تغييرات را خواهيد ديد ...

( براي سهولت كار فايل رو ضميمه كردم ، ميتونيد دريافت كنيد )

موفق باشيد
 

Hyper

Active Member
لطفا کلید
post_thanks.gif


:wink:
 

sayeh2222

Member
Parse error: parse error in c:program fileseasyphp1-8wwwforumsindex.php on line 455
اقا ما ریختیم ولی این ارور اومد چه کنم
 

Hyper

Active Member
دوباره امتحان کنید

قطعا جایی رو اشتباه کرده اید ...
 

قیصر

Member
خیلی ممنون Parham جان واقعا برا خودم متاسفم که جمله به این ساده ای را نفهمیدم
 
من اون كد رو اضافه كردم اما انجمن نمي اره

ميشه يه نمونه بهم بديد


ممنون

منظورم اون كد مال ايندكس هست
 

Hyper

Active Member
قطعا کد را بدرستی و در جای مناسب فایل index.php کپی نکرده اید !

دوباره سعی کنید ...

رضا
 

Hyper

Active Member
فایل index.php رو بزارید اینجا تا من براتون درستش کنم ...

رضا
 

bache +

Well-Known Member
1.فايل ضميمه كو؟
2.صفحه اسكرول من اين ارور رو ميده
503 Service Unavailable
Connection refused.
--------------------------------------------------------------------------------
3.صفحه اصلي اصلا ديگه وا نميشه
4.با توجه به اينكه اكثرا ميگن اين فايل مشكل داره پس داره
5.اقا ي هايپر با اينكه ارادت خاصي نسبت به شما دارم ولي الكي كلي وقت من گرفته شد لطفا اول تست كنيد
 

bache +

Well-Known Member
اين اندكس منه مرسي:wink:
 

پیوست ها

  • index.rar
    4 کیلوبایت · بازدیدها: 19

siavashmusic

Active Member
Hyper جان ممنون
مثل هميشه عاليه ولي کاشکي اين بخش بي بي بيشتر فعاليت کنه ميدونم تنهايي و سخت اما مطمنا از پس بر مياي منتظريم
 

Miesam

Member
ببخشید این مد میره بالا ایا نمیشه در یک کادر قرار داد و بجای این که از پایین به بالا بره وایسه مثل انجمن ها حامد سافت
ببخشید من هنوز مد نصب نکردم ولی اگر اینجوری میشه اون که من گفتم کرد؟
 

Hyper

Active Member
در فایل scroll.php این خط رو حذف کنید :

PHP:
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()">";

رضا
 

Miesam

Member
اقا رضا ممنون من اون کد که صفحه قبل گفتید توی Index اضافه که میکنم ارور میده
چه کنم؟ بعد چند خط بالاتر که قرار میدم ارور نمیده ولی هیچ چیزی هم تغییر نکرده
راستی این هیچ کدی برای قالب نداره؟
ببخشید همیشه به شما زحمت میدم
 

جدیدترین ارسال ها

بالا