สืบเนื่องจากกระทู้
http://www.phpbbthailand.com/viewtopic.php?f=25&t=5585" onclick="window.open(this.href);return false; (ทำไมไม่เรียงตามเวลาคนโพสต์ของหัวข้อกระทู้อ่ะครับ)
http://www.phpbbthailand.com/viewtopic.php?f=27&t=6567" onclick="window.open(this.href);return false; (ทำให้บอร์ดแสดงหัวข้อ(topic)ตามเวลาที่โพส)
http://www.phpbbthailand.com/viewtopic.php?f=25&t=3708" onclick="window.open(this.href);return false; (การเรียงลำดับหัวข้อกระทู้)
ก่อนโม phpbb3 สามารถเรียงกระทู้ในหน้าบอร์ดแต่ละบอร์ดตามนี้ ลองเข้าไปดูที่หน้า
http://www.phpbbthailand.com/ucp.php?i=prefs&mode=view" onclick="window.open(this.href);return false;
ให้ดูที่ เรียงลำดับกระทู้ตาม: ซึ่งจะเรียงได้ตามนี้
เจ้าของ -------> ชื่อเจ้าของ
เวลา ---------> เวลาที่ตอบกลับ
ตอบกลับ------> จำนวนที่ตอบกลับ
หัวข้อ--------> ซื่อหัวข้อ
แสดง--------> จำนวนครั้งที่แสดง
กระทู้นี้ผมเราจะมาเพิ่มให้ phpbb3 ของเราเรียงตามเวลาตั้งกระทู้กัน นะครับ
ก่อนทำให้ Backup ไฟล์ และฐานข้อมูลไว้ก่อนนะครับ
แก้ไขไฟล์ ต่างๆ เหล่านี้
เปิดไฟล์ viewforum.php
ค้นหา
โค้ด: เลือกทั้งหมด
$sort_by_text?=?array('a'?=>?$user->lang['AUTHOR'],?'t'?=>?$user->lang['POST_TIME'],?'r'?=>?$user->lang['REPLIES'],?'s'?=>?$user->lang['SUBJECT'],?'v'?=>?$user->lang['VIEWS']);?
โค้ด: เลือกทั้งหมด
//?Sort?by?topic?time?ADDED?'m'?=>?$user->lang['SORT_TOPIC_TIME'],
$sort_by_text?=?array('a'?=>?$user->lang['AUTHOR'],?'t'?=>?$user->lang['POST_TIME'],?'m'?=>?$user->lang['SORT_TOPIC_TIME'],?'r'?=>?$user->lang['REPLIES'],?'s'?=>?$user->lang['SUBJECT'],?'v'?=>?$user->lang['VIEWS']);?
โค้ด: เลือกทั้งหมด
$sort_by_sql?=?array('a'?=>?'t.topic_first_poster_name',?'t'?=>?'t.topic_last_post_time',?'r'?=>?'t.topic_replies',?'s'?=>?'t.topic_title',?'v'?=>?'t.topic_views');?
โค้ด: เลือกทั้งหมด
//?Sort?by?topic?time?ADDED?'m'?=>?'t.topic_time',
$sort_by_sql?=?array('a'?=>?'t.topic_first_poster_name',?'t'?=>?'t.topic_last_post_time',?'m'?=>?'t.topic_time',?'r'?=>?'t.topic_replies',?'s'?=>?'t.topic_title',?'v'?=>?'t.topic_views');?
ค้นหา
โค้ด: เลือกทั้งหมด
????????????????$sort_by_topic_text?=?array('a'?=>?$user->lang['AUTHOR'],?'t'?=>?$user->lang['POST_TIME'],?'r'?=>?$user->lang['REPLIES'],?'s'?=>?$user->lang['SUBJECT'],?'v'?=>?$user->lang['VIEWS']);?
โค้ด: เลือกทั้งหมด
//?Sort?by?topic?time?ADDED?'m'?=>?$user->lang['SORT_TOPIC_TIME'],
????????????????$sort_by_topic_text?=?array('a'?=>?$user->lang['AUTHOR'],?'t'?=>?$user->lang['POST_TIME'],?'m'?=>?$user->lang['SORT_TOPIC_TIME'],?'r'?=>?$user->lang['REPLIES'],?'s'?=>?$user->lang['SUBJECT'],?'v'?=>?$user->lang['VIEWS']);?
โค้ด: เลือกทั้งหมด
????????????????$sort_by_topic_sql?=?array('a'?=>?'t.topic_first_poster_name',?'t'?=>?'t.topic_last_post_time',?'r'?=>?'t.topic_replies',?'s'?=>?'t.topic_title',?'v'?=>?'t.topic_views');?
โค้ด: เลือกทั้งหมด
//?Sort?by?topic?time?ADDED?'m'?=>?'t.topic_time',
????????????????$sort_by_topic_sql?=?array('a'?=>?'t.topic_first_poster_name',?'t'?=>?'t.topic_last_post_time',?'m'?=>?'t.topic_time',?'r'?=>?'t.topic_replies',?'s'?=>?'t.topic_title',?'v'?=>?'t.topic_views');?
โค้ด: เลือกทั้งหมด
?'SORT_RANK'??
โค้ด: เลือกทั้งหมด
?'SORT_TOPIC_TIME'?=>?'เวลาตั้งกระทู้',?
ค้นหา
โค้ด: เลือกทั้งหมด
????'SORT_RANK'????????????????????=>?'Rank',?
โค้ด: เลือกทั้งหมด
??????'SORT_TOPIC_TIME'?=>?'Topic?time',?
โค้ด: เลือกทั้งหมด
'SORT_SIZE'?
โค้ด: เลือกทั้งหมด
'SORT_TOPIC_TIME'?=>?'เวลาตั้งกระทู้',?
ค้นหา
โค้ด: เลือกทั้งหมด
????'SORT_SIZE'????????????????????=>?'File?size',?
โค้ด: เลือกทั้งหมด
????'SORT_TOPIC_TIME'?=>?'Topic?time',?
ค้นหา
โค้ด: เลือกทั้งหมด
$sort_by_topic_text?=?array('a'?=>?$user->lang['AUTHOR'],?'t'?=>?$user->lang['POST_TIME'],?'r'?=>?$user->lang['REPLIES'],?'s'?=>?$user->lang['SUBJECT'],?'v'?=>?$user->lang['VIEWS']);?
โค้ด: เลือกทั้งหมด
$sort_by_topic_text?=?array('a'?=>?$user->lang['AUTHOR'],?'t'?=>?$user->lang['POST_TIME'],?'m'?=>?$user->lang['SORT_TOPIC_TIME'],?'r'?=>?$user->lang['REPLIES'],?'s'?=>?$user->lang['SUBJECT'],?'v'?=>?$user->lang['VIEWS']);?
ถ้าต้องการให้ บอร์ดเราเริ่มต้นด้วยการเรียงตามเวลาตั้งกระทู้สำหรับทุกคนให้เอาโค้ดนี้ไปรันด้วย phpMyadmin
โค้ด: เลือกทั้งหมด
ALTER TABLE `phpbb_users` CHANGE `user_topic_sortby_type` `user_topic_sortby_type` VARCHAR( 1 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 'm'
โค้ด: เลือกทั้งหมด
UPDATE `phpbb_users` SET user_topic_sortby_type = 'm'
ปล.โค้ดนี้เป็นส่วนที่ผมปรับปรุงจาก mod Sort by topic time
โดยผมเพิ่มในส่วนของ
- admin ให้สามารถบังคับให้ สมาชิกแต่ละคนเรียงกระทู้ตามเวลาตั้งกระทู้ได้
การใช้งานเข้าไปที่ ACP >> จัดการผู้ใช้ >> กรอกชื่อคนที่ต้องการจัดการ >> เลือกฟอร์ม: ค่าที่ปรับแต่งไว้แล้ว >> เรียงลำดับกระทู้ตาม: จะมี เวลาตั้งกระทู้ เพิ่มขึ้นมาให้เราเลือกใช้ได้ครับ
- ปรับแต่งตาราง ตามโค้ด sql ด้านบน
- อัพเดดข้อมูลเก่าของ ทุกคน ตามโค้่ด sql ข้างบน