ติดต่อลงโฆษณา [email protected]

แสดงกระทู้

ส่วนนี้จะช่วยให้คุณสามารถดูกระทู้ทั้งหมดสมาชิกนี้ โปรดทราบว่าคุณสามารถเห็นเฉพาะกระทู้ในพื้นที่ที่คุณเข้าถึงในขณะนี้


ข้อความ - woot

หน้า: [1]
1
ผมก็ติดตั้ง mod แล้วก็ใช้ไม่ได้เหมือนกันครับ ไม่ใช่ mod ใช้ไม่ได้นะครับ แต่ด้วยสภาพแวดล้อมของ hosting ที่ต่างกันอาจทำให้ mod Thai Year ดู เหมือนใช้ไม่ได้

ผมดูโค๊ดใน ~Sources/Subs.php แล้ว คิดว่าเป็นเงื่อนไขนี้ที่ ถึงแม้ว่าเราจะติดตั้ง mod แล้ว การแสดงผลของปีก็ยังไม่เปลี่ยนเป็น พ.ศ.
บรรทัดที่ 861: if (setlocale(LC_TIME, @$txt['lang_locale']))

ถ้าเงื่อนไขข้างบนดังกล่าวเป็นจริง script จะไม่รันคำสั่งในส่วนของ mod ที่เราติดตั้งเพิ่มเข้าไป ผมแก้ไขโค๊ดใน Subs.php เพื่อให้แสดงผลปีเป็น พ.ศ. อย่างถูกต้อง โดยเพิ่มโค๊ด 2 บรรทัดดังนี้ในฟังก์ชั่น  timeformat ครับ
function timeformat($logTime, $show_today = true)
.
.
.
if (setlocale(LC_TIME, @$txt['lang_locale']))
   {
      $str = str_replace('%a', ucwords(strftime('%a', $time)), $str);
      $str = str_replace('%A', ucwords(strftime('%A', $time)), $str);
      $str = str_replace('%b', ucwords(strftime('%b', $time)), $str);
      $str = str_replace('%B', ucwords(strftime('%B', $time)), $str);
      // Convert Common Era (C.E.) into Buddhist Era (B.E., aka Thai year)
      $str = str_replace('%y', (strftime('%y', $time)+543)%100, $str);
      $str = str_replace('%Y', strftime('%Y', $time)+543, $str);

   }
   else
   {
      // Convert Common Era (C.E.) into Buddhist Era (B.E., aka Thai year) โค๊ดที่เพิ่มโดย mod Thai Year คือ 3 บรรทัดข้างล่างนี้ครับ
      $time_array = getdate( $time );
      $str = str_replace('%y', ( $time_array['year'] + 543 ) % 100, $str);
      $str = str_replace('%Y', $time_array['year'] + 543, $str);

      // Do-it-yourself time localization.  Fun.
      $str = str_replace('%a', @$txt['days_short'][(int) strftime('%w', $time)], $str);
      $str = str_replace('%A', @$txt['days'][(int) strftime('%w', $time)], $str);
      $str = str_replace('%b', @$txt['months_short'][(int) strftime('%m', $time)], $str);
      $str = str_replace('%B', @$txt['months'][(int) strftime('%m', $time)], $str);
      $str = str_replace('%p', (strftime('%H', $time) < 12 ? 'am' : 'pm'), $str);
   }

   // Format any other characters..
   return strftime($str, $time);
   }

ลองดูนะครับ
สำหรับบอร์ดของคนที่แสดงผลถูกต้องแล้ว ไม่ต้องเปลี่ยนนะครับ แต่ถ้าของใครยังใช้ไม่ได้ก็ลองดูนะครับ แบ็คอัพไฟล์ Subs.php ก่อนแก้ไขโค๊ดนะครับ

หน้า: [1]