درس عمل شريط اخر عشر مواضيع هي كالتالي :
افتح مفكرة جديدة وسمها باسم configlast.php
وضع بداخلها الكود الاتي:
كود:
<?
/////////////// CONFIG ///////////////
//
// لا تضع علامة ( / ) عند تحديد المسارات
$path = "\admin"; // مسار ملف config.php في مجلد المنتدى
$url = "http://www.2sarah.com/vb"; // مسار موقع المنتدى
$urlimg = "http://www.2sarah.com/vb/images"; // مسار مجلد الصور بالمنتدى
$maxthreads = "15"; // العدد الذي تريد عرضه من المواضيع في آخر المشاركات
$hc = "#582840"; // لون الخلفية background color
$ob = "lastpost"; // set to one of the following: replycount , views , lastposter , title , lastpost (lastpost is most popular. it's the thread most recently replied to, then the second-to-last most recent, etc.)
$obdir = "desc"; // المجلد الذي يتم فيه الترتيب which direction to sort? "desc" goes from bottom to top (9 to 1, z to a, etc.). "asc" goes top to bottom (1 to 9, a to z, etc.). if you use lastpost for $ob, leave this set to desc or it will not work correctly!
$last24 = "0"; // 1 = last 24 hours; 0 = all (must set this to 0 if $last7 is set to 1)
$last7 = "0"; // 1 = last 7 days; 0 = all (must set this to 0 if $last24 is set to 1)
$bc1 = "#f2f2ff"; // لون أول موضوع first alt color
$bc2 = "#f2f2ff"; // لون الموضوع التالي second alt color
$lc = "#f2f2ff"; // لون الرابط link color
$tc = "#f2f2ff"; // لون النص text color
$f = "MS Sans Serif"; // نوع الخط font face
$fs = "3"; // حجم الخط font size in points - 8 is normal, 6 is on the small side, 10 on the large side. play around with it. :)
$lastposter = "0"; // عرض آخر كاتبshow last poster? 1 = yes; 0 = no
$views = "0"; // عرض إحصاء الموضوعshow view count? 1 = yes; 0 = no
$replies = "0"; // عرض إحصاء الرد show reply count? 1 = yes; 0 = no
$lastpostdate = "0"; // عرض تاريخ ووقت آخر رد show last post date and time? 1 = yes; 0 = no
$len = 25 ; // أقصى عدد من الاحرف لعرضها في الموضوع maximum number of characters of the title to show. e.g. if the title is 60 characters and this is set to 25, only the first 25 characters of the title will be shown (followed by ...)
$excludeforums = ""; //إذا تريد استثناء منتدى معين ضع رقمه هنا if you want to exclude a forum, put it's ID here. more than one, seperate them with commas, NO SPACES! e.g. 1,2,3,4
$includeforums = ""; // إذا تريد تحديد منتدى معين ضع رقمه هنا if you only want to include certain forums, put their ids here. separate more than one with commas, NO SPACES! e.g. 1,2,3,4
$showmessages = "0"; // عرض نص لآخر رد طويل show the text of the last post too? 1 = yes; 0 = no
$lplen = "300"; // عدد الاحرف في آخر نص آخر رد character length of last post text (if $showmessages is set to 0 this won't do anything).
$tw = "600"; // طول الجدول لعرض المعلوماتwidth of the table that shows the info, in either a percent ( e.g. 95% ) or in pixels ( e.g. 300 ). leave blank if you want the table to be sized naturally
$showdate = "0"; // عرض التاريخ بصيغة الوقت show the date, as well as the time? if the posts that show up in the list are likely to all be from today (or you set $last24 to "1"), you can set this to 0. if the posts are spread over multiple days, you probably want this set to 1.
$cs = "0"; // تحديد المسافة بين حقول الجدول this is the cellspacing. 1 makes a thin line around the cells. 0 makes no line.
$showicon = "0"; // استعراض رموز آخر المواضيع shows the posts' icon next to the post
$showforumtitle = "0"; // عرض عنوان المنتدى (linked to that forum) next to the thread title
$nb = "0"; // هل تريد عرض خط فاصل بين النصوص do you want breaks in text to appear as such? this may cause problems if there are large breaks in the text
//
///////////// END CONFIG /////////////
?>
مع تغيير عنوان المنتدى الموضوع بهذا النمط في الكود السابق www.2sarah.com/vb
وتغيير عنوان مجلد الصور كما هو موضح في الكود السابق
www.2sarah.com/vb/images
واذا شئت ان تغير خلفية الشريط او تبقيها وتغيير خصائص الالوان كما هو موضح
وتحفظ الملف كما عدلته انت ونأتي للخطوة الثانية
والآن نأتي للملف الثاني تفتح المفكرة ايضا وتجعلها باسم last.php
وتضع بها الكود الاتي :
كود:
<?
//...............Last X Posts v2.0.1...........\\
//.....Edit by lad_pc (lad_pc@hotmail.com)......\\
//.............تطوير : B2S ..........\\
//......... (c) 2001 taiba.port5.com ...........\\
// vBulletin.com thread: http://www.vbulletin.com/forum/showt...threadid=12324
// vBulletin.com thread: http://www.taiba.port5.com/ let's get connected
?>
<html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html DIR="RTL" LANG="AR-SA">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<meta http-equiv="Content-Language" content="ar-sa">
<title>آخر المشاركات</title>
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<meta http-equiv="MSThemeCompatible" content="Yes">
<style type="text/css">
A:link, A:visited, A:active {COLOR: #f2f2ff;}
A:hover {COLOR: #f2f2ff;}
</style>
<base target="_blank">
</head>
<body bgcolor="#582840">
<center>
<? include("ttlast.php"); ?>
</center>
</body>
</html>
وتحفظها وفي هذا السطر من الكود السابق تستطيع تغيير لون الخلفية في الشريط السابق
كود:
<body bgcolor="#582840">
وتحفظ الملف كما سميناه
3-وناتي للخطوة الثالثة والملف الثالث نفتح المفكرة ونسمي الملف باسم ttlast.php
وتحط فيه هالكود التالي :
كود:
<?
require("configlast.php");
require("admin/config.php");
echo "<FONT color=$tc ><marquee dir=\"rtl\" direction=\"right\" scrolldelay=\"100\">";
//...............Last 10 Posts v2.0.1...........\\
//.........by Kevin (kevin@tubescan.com)........\\
//.....Edit by B2S (me@2sarah.com)......\\
//........تطوير وتعديل : B2S .........\\
//......... (c) 2001 taiba.port5.com ...........\\
// vBulletin.com thread: http://www.vbulletin.com/forum/showt...threadid=12324
// vBulletin.com thread: http://www.taiba.port5.com/ let's get connected
$db=mysql_connect($servername,$dbusername,$dbpassword) or die("Can't open connection to MySQL");
mysql_select_db($dbname) or die("Can't select database");
$hfs = $fs+2;
$fs .= "pt";
$hfs .= "pt";
// the base WHERE statement
$wheresql = "WHERE thread.lastposter=user.username AND thread.open!='10'";
// we can't have both the last 24 hours *and* the last 7 days, so error out if needed
if ($last24 == "1" && $last7 == "1") {
print("Error: \$last24 and \$last7 are both set to 1. Please change one of them to 0.");
exit;
}
// otherwise we're gonna find out which one it is
// last 24
if ($last24 == "1") {
$time = time()-86400;
$wheresql .= " AND thread.lastpost>'$time'";
}
// last 7
if ($last7 == "1") {
$time = time()-604800;
$wheresql .= " AND thread.lastpost>'$time'";
}
// are we trying to exclude *and* include forums? if so, error out
if ($excludeforums != "" && $includeforums != "") {
print("Error: \$includeforums and \$excludeforums are both set with numbers. Please remove the numbers from <b>one</b> of these two to proceed.");
exit;
}
// otherwise figure out which one we're using
// include forums
if ($includeforums == "" or $includeforums <= "0") {
$quarter = "no";
} else {
$incfid = explode(",",$includeforums); $i = 0; $a = count($incfid);
if ($a > 1) {
$wheresql .= " AND (thread.forumid='$incfid[0]'";
++$i;
while ($i * $a) {
$wheresql .= " OR thread.forumid='$incfid[$i]'"; ++$i;
}
$wheresql .= ")";
} else {
$wheresql .= " AND thread.forumid='$incfid[$i]'";
}
}
// or exclude forums
if ($excludeforums == "" or $excludeforums <= "0") {
$quarter = "no";
} else {
$excfid = explode(",",$excludeforums); $i = 0; $a = count($excfid);
while ($i < $a) {
$wheresql .= " AND thread.forumid!='$excfid[$i]'"; ++$i;
}
}
// ooh a query!
$query = "SELECT thread.lastpost,thread.title,thread.lastposter,thread.replycount,thread.views,user.userid,thread.threadid,thread.forumid$fsel,thread.iconid FROM thread,user$ftitle $wheresql ORDER BY thread.$ob $obdir LIMIT $maxthreads";
// let's get the info
$tr = mysql_query($query) or die("MySQL reported this error while trying to retreive the info: ".mysql_error());
$dtf = mysql_query("SELECT value FROM setting WHERE varname='dateformat' OR varname='timeformat' OR varname='timeoffset' ORDER BY varname");
$df = mysql_result($dtf,0,0);
$tf = mysql_result($dtf,1,0);
$tof = mysql_result($dtf,2,0);
// let's display the info
while ($threads = mysql_fetch_array($tr)) {
echo " <B><FONT SIZE=\"3\" FACE=\"arial\"><a href=\"$url/showthread.php?threadid=$threads[threadid]&goto=newpost\" title=\"$threads[title]\" target=_blank>$threads[title]</a>   للكاتب :  <a href=\"$url/member.php?action=getinfo&find=lastposter&threadid=$threads[threadid]&goto=newpost\" title=\"$threads[title]\" target=_blank>$threads[lastposter]</a>    <FONT COLOR=\"f2f2ff\">:_-*:o:*-_:</FONT>    </font>";
}
// close it all up
// bye!
?></marquee>
وتحفظه بصيغة php ولازم الملفات الثلاثة كلها اللي عملنها تحفظ بصيغة php وتروح الحين للهيدر في لوحة تحكم المنتدى او تحرر تيمبلت forumhome بالفرونت بيج وتحط هالكود في اي مكان ودك يطلع شريط اخر عشر مواضيع فيه وهذا هو الكود اللي تحطه في الفورم هوم او الهيدر
كود:
<IFRAME FRAMEBORDER=0 ALIGN=CENTER width=100% HEIGHT=35 SCROLLING=no SRC="http://localhost/vb/last.php" marginwidth="1" marginheight="1" ></IFRAME>
واعط التيبلت سيف وانقل الملفات اللي عملنها الى مجلد المنتدى على حسب ما انت مسمية سواء vb او forum او اي اسم وانشالله يضبط
لاتنسونا من الدعااااااااء ياشباب
الهاك ماخوذ من شرح هاك موجود عندي كنت بارفقه لكم لكن سوالف منعت هالشي
بس هذا درس هاك اخر عشر مواضيع