วันศุกร์ที่ 18 กุมภาพันธ์ พ.ศ. 2554

แก้ไขหัวข้อ ยาวแล้วตัด ༯a>

แก้ไขหัวข้อ  ยาวแล้วตัด ༯a> 
สาเหตุ  
- เกิดจากฐานภาษาของโฮสต์กับบอร์ดที่ลงไม่ตรงกัน
ปัญหา  
- บางหัวข้อก้ยังเข้าไปได้ (แต่มันรำคาญสายตา)
- บางหัวข้อขาวจั๊ว

วิธีแก้

วิธีที่ 1 โดย thaipic    ที่มา  http://www.thaiseoboard.com/


อ้างถึง
ของผมใช้วิธีกำหนดคุณสมบัติของฟิวล์ subject เป็นแบบ text 
และที่แก้ได้ชัวร์ๆคือ กำหนด Encoding จาก utf-8 เป็น tis-620 ไปเลยอ่ะครับ

อ้างถึง
เป็นเพราะ field "subject" ใน table "smf_messages" มันเป็น TINYTEXT ครับ

เอาสคริปต์ sql ดังนี้ไปรัน เพื่อเปลี่ยนฟิลด์นี้ให้เป็น MEDIUMTEXT

ALTER TABLE `micnet_smf`.`smf_messages` MODIFY COLUMN `subject` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;


หรือ
เปิดไฟล์  /Sources/Post.php แล้วหาบรรทัดคำสั่ง

   // Make sure the subject isn't too long - taking into account special characters.
   if ($func['strlen']($form_subject) > 100)
      $form_subject = $func['substr']($form_subject, 0, 100);

   // At this point, we want to make sure the subject isn't too long.
   if ($func['strlen']($_POST['subject']) > 100)
      $_POST['subject'] = addslashes($func['substr'](stripslashes($_POST['subject']), 0, 100));

   // Maximum number of characters.
   if ($func['strlen']($_POST['subject']) > 100)
      $_POST['subject'] = addslashes($func['substr'](stripslashes($_POST['subject']), 0, 100));
ลองเปลี่ยนตัวเลขจาก 100 ให้เพิ่มขึ้นเป็นซัก 300 - 500 แทน

บอร์ดผมก็เคยเป็นครับ..CreDit Rcw

อ้างถึง
แก้ได้ด้วยการเข้าไปที่ phpMyAdmin แล้วรัน 
โค๊ด:
ALTER TABLE smf_messages
CHANGE COLUMN subject subject text;

จากนั้นเปิดไฟล์ Sources/Post.php แล้วหา 
โค๊ด:
      // Make sure the subject isn't too long.
      if (strlen($form_subject) > 100)
         $form_subject = substr($form_subject, 0, 100);กับ 
โค๊ด:
   // At this point, we want to make sure the subject isn't too long.  Stripslashes first to avoid a trailing slash.
   if (isset($_POST['subject']) && strlen(stripslashes($_POST['subject'])) > 100)
      $_POST['subject'] = addslashes(substr(stripslashes($_POST['subject']), 0, 100));
หาเจอแล้วก็ลบออกทั้งสองที่ หรือจะ comment ไว้ก็ได้


เสร็จแล้วไปไฟล์ Post.template.php ของธีมที่ใช้ แล้วหา 
โค๊ด:
<input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' size="80" maxlength="80"tabindex="1" />
หาเจอแล้วก็ลบส่วนที่ระบุว่า maxlength="80" ออก

วิธีที่ 2 โดย Thenetwork ที่มา http://www.thaiseoboard.com/
วิธีที่ 3  โดย au8ust  ที่มา  http://www.zone-it.com/ 

ไม่มีความคิดเห็น:

แสดงความคิดเห็น