ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

ThaiSEOBoard.comพัฒนาเว็บไซต์CMS & Free Scriptวิธีสร้าง mod เว็บบอร์ดsmfลองทำดูครับไม่ยาก!
หน้า: [1]   ลงล่าง
พิมพ์
ผู้เขียน หัวข้อ: วิธีสร้าง mod เว็บบอร์ดsmfลองทำดูครับไม่ยาก!  (อ่าน 1665 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
WACHIRAPILAN
Newbie
*

พลังน้ำใจ: 9
ออฟไลน์ ออฟไลน์

กระทู้: 70



ดูรายละเอียด
« เมื่อ: 22 ธันวาคม 2014, 22:16:04 »

วิธีสร้าง mod เว็บบอร์ดsmf ใช้งานเองแบบง่ายๆ
หลายคนสงสัยว่าทำไมต้องสร้าง mod ใช้เองให้มันยุ่งยาก ในเมื่อของฝรั่งก็มีให้เลือกใช้เยอะแยะไป อันนี้ผมว่ามันก็จริงนะครับ แต่คุณรู้ไหมครับว่า mod เกือบทุกตัวมีแต่คนต่างชาติเขาเป็นคนทำ " แล้วทำไมคนไทยจะทำให้คนอื่นใช้บ้างไม่ได้ " ผมว่าความรู้ความสามารถของไทยเราก็ไม่ด้อยไปกว่าชาติใดในโลกเลยนะครับ.

"แค่เราลงมือสร้าง"
เริ่มต้นด้วยการศึกษาว่าเขาทำกันยังไงที่ลิงค์นี้ครับ http://www.simplemachines.org/...munity/index.php?topic=20319.0

หลังจากที่เข้าไปศึกษาวิธีสร้างตามลิงค์ข้างบนแล้ว ให้เราดาวน์โหลดไฟล์  " package-sdk_0.6.zip " ซึ่งอยู่ในไฟล์แนบของลิงค์ข้างบนแล้วแตกไฟล์ออกจะเห็นไฟล์สำหรับใช้ทำเป็น mod ติดตั้งของเว็บบอร์ด smf

หลังจากที่เราได้ไฟล์ติดตั้งมาแล้วทีนี่ก็มาถึงวิธีการสร้าง mod เพื่อใช้งานกันครับ
ขั้นตอนแรกเราจะเริ่มสร้าง mod ตัวง่ายๆกันก่อนนะครับ โดยผมจะเลือกสร้าง mod " ย้ายเวอร์ชั่นเว็บบอร์ด SMF 2.0.7 " ให้ชิดขวา

ขั้นตอนแรกให้เรานำไฟล์ต่อไปนี้มาแก้ไข 1. package-info.xml  2. modification.xml

วิธีแก้ไขไฟล์ package-info.xml
ภายในไฟล์จะประกอบไปด้วยโค๊ดเหล่านี้
<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info ">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 This is a simplified package manifest for SMF packages.

 ATTENTION: If you are trying to install this manually, you should try
 the package manager.  If it will not work for you, please take a look
 at the following for information on this format:
  http://www.simplemachines.org/redirect/manual_mod_install

================================================================================

 This script can be used to make your package do many different things.
 The following documentation should be available on the format of this
 file and the things you can do with it:
  http://www.simplemachines.org/redirect/mod_package_sdk

 Please see the other included file, package-info_advanced.xml, for
 a more detailed description of what you can do with this file.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<package-info xmlns="http://www.simplemachines.org/xml/package-info " xmlns:smf="http://www.simplemachines.org/ ">
 <!-- For the id, always use something unique - put your name, a colon, and then the package name. -->
 <id>username:testing123</id>
 <!-- Below should be the name of this package. -->
 <name>Testing, 1-2-3!</name>
 <!-- The version of this modification.  Keep it numeric so PHP can tell that old < new. -->
 <version>1.0</version>

 <!-- Type, one of: modification, avatar, language. -->
 <type>modification</type>

 <!-- Installation, the key part of this file. -->
 <install>
  <readme>readme.txt</readme>
  <modification>install.xml</modification>
  <code>add_settings.php</code>
 </install>

 <!-- Don't forget something to make it uninstallable! -->
 <uninstall>
  <modification reverse="true">install.xml</modification>
 </uninstall>
</package-info>


จากข้างบนให้เราแก้ไขโค๊ดดังต่อไปนี้

1.<id>username:testing123</id>  แก้เป็น <id>ชื่อของเรา:ชื่อของmodที่เราสร้าง</id> (ชื่อของmodห้ามเว้นวรรคโดยเด็ดขาด)

2.<name>Testing, 1-2-3!</name> แก้เป็น <name>ชื่อของmodที่เราสร้าง</name> (ชื่อตรงนี้สามารถเว้นวรรคได้)

3.<version>1.0</version>  แก้เป็น <version>เวอร์ชั่นmodของเรา</version> (ตั้งค่าเวอร์ชั่นmodตามต้องการ)

4.<install>  แก้เป็น <install for="2.0.7"> (ใส่เวอร์ชั่นของเว็บบอร์ดที่รองรับmodนี้)
4.1 จากนั้นให้เราลบโค๊ดนี้ทิ้ง <code>add_settings.php</code>

5.<uninstall> แก้เป็น <uninstall for="2.0.7"> (ใส่เวอร์ชั่นของเว็บบอร์ดที่รองรับmodนี้)

หลังจากแก้ไขเสร็จแล้วจะมีโค๊ดอยู่2บรรทัดที่ยังไม่ได้แก้ไขคือโค๊ดต่อไปนี้
1.<readme>readme.txt</readme> คือไฟล์ readme.txt ที่เราต้องสร้างขึ้นมาใหม่เพื่อใส่ข้อมูลต่างๆเช่น อธิบายคุณสมบัติของmod วิธีใช้งานmod และที่สำคัญต้องแสดงลิขสิทธิ์ของmodด้วย

2. <modification>install.xml</modification> คือไฟล์ติดตั้ง install.xml  ที่เราจะต้องเขียนคำสั่งให้มันแก้ไขโค๊ดของเราในขั้นตอนต่อไป


วิธีแก้ไขไฟล์ modification.xml
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification ">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 This is an example modification file for SMF packages.

 ATTENTION: If you are trying to install this manually, you should try
 the package manager.  If it will not work for you, please take a look
 at the following for information on this format:
  http://www.simplemachines.org/redirect/manual_mod_install

================================================================================

 Modification files can be used to modify files so that they do what
 your package needs them to do to work properly.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<modification xmlns="http://www.simplemachines.org/xml/modification " xmlns:smf="http://www.simplemachines.org/ ">
 <!-- This information needs to be the same as that in the package-info.xml. -->
 <id>username:testing123</id>
 <version>1.0</version>

 <!-- Edit a specific file.. -->
 <file name="$sourcedir/Filename.php">
  <!-- A seach operation, with search rules and code to modify the file with. -->
  <operation>
   <!-- Search for this text before the code we add.  You can also search for after, and the end of the file. -->
   <search position="before"><![CDATA[
Search for some code to add stuff after.
]]></search>
   <!-- Add this text when we find it.  Note that it's on it's own line on purpose, and the CDATA keeps things clean. -->
   <add><![CDATA[
This is what to add.
]]></add>
  </operation>

  <operation>
   <search position="replace"><![CDATA[
Another search operation?
]]></search>
   <add><![CDATA[
Yes, another.  This time, replacing!
]]></add>
  </operation>
 </file>
</modification>


จากไฟล์ข้างบนให้เราแก้ไขโค๊ดดังต่อไปนี้

1.<id>username:testing123</id> แก้เป็น <id>ชื่อของเรา:ชื่อของmodที่เราสร้าง</id> (ชื่อของmodห้ามเว้นวรรคโดยเด็ดขาด)

2.<version>1.0</version> แก้เป็น <version>เวอร์ชั่นmodของเรา</version> (ตั้งค่าเวอร์ชั่นmodตามต้องการ)

3.<file name="$sourcedir/Filename.php"> แก้เป็น <file name="$themedir/css/index.css"> (โค๊ดตัวนี้คือประตูทางเข้าไปจัดไฟล์ของmodเรา)

4.<operation>
   <!-- Search for this text before the code we add.  You can also search for after, and the end of the file. -->
   <search position="before"><![CDATA[
Search for some code to add stuff after.
]]></search>

แก้เป็น <!-- Search for this text before the code we add.  You can also search for after, and the end of the file. -->
   <search position="replace"><![CDATA[
#footer_section
{
 text-align: center;
 background: url(../images/theme/main_block.png) no-repeat 0 -820px;
 padding-left: 20px;
}
]]></search>

จากข้างบนให้สังเกตุตรงจุดนี้นะครับ <search position="before"><![CDATA[
Search for some code to add stuff after.
]]></search>

จุดที่ผมแก้ไขคือ
1. <search position="before">   ผมแก้ before เป็น replace

2.<![CDATA[Search for some code to add stuff after.]]></search> ผมเปลี่ยนข้อความ "Search for some code to add stuff after." เป็นโค๊ด

5.<!-- Add this text when we find it.  Note that it's on it's own line on purpose, and the CDATA keeps things clean. -->
   <add><![CDATA[
This is what to add.
]]></add>
  </operation>

แก้เป็น
 <!-- Add this text when we find it.  Note that it's on it's own line on purpose, and the CDATA keeps things clean. -->
   <add><![CDATA[
#footer_section
{
 text-align: right;
 background: url(../images/theme/main_block.png) no-repeat 0 -820px;
 padding-left: 20px;
}
]]></add>
  </operation>

จุดที่ผมแก้ไขคือ
1.<![CDATA[This is what to add.]]></search> ผมเปลี่ยนข้อความ "This is what to add." เป็นโค๊ด


หลังจากเสร็จแล้วให้เราลบโค๊ดส่วนที่ไม่ใช้ทิ้งคือโค๊ดนี้
<operation>
   <search position="replace"><![CDATA[
Another search operation?
]]></search>
   <add><![CDATA[
Yes, another.  This time, replacing!
]]></add>
  </operation>

เสร็จแล้วให้บันทึกและเปลี่ยนชื่อไฟล์เป็น install.xml

จาก mod ที่เราสร้างก็จะมีไฟล์ทั้งหมด 3 ไฟล์หลักๆคือ
1. install.xml
2.readme.txt
3.package-info.xml

ขั้นตอนสุดท้ายให้รวมไฟล์ทั้ง3เป็นไฟล์ .zip เพียงเท่านี้เราก็จะได้ mod เว็บบอร์ด smf สร้างโดยผีมือตัวท่านเองเป็นที่เรียบร้อย
ที่มา: http://www.thailandmovingguide...om/modifications/mod-smf-1107/

ปล.ฝากผลงานด้วยนะครับ
1. http://custom.simplemachines.org/mods/index.php?mod=3829
2.http://custom.simplemachines.org/mods/index.php?mod=3835
3.http://custom.simplemachines.org/mods/index.php?mod=3838
4.http://custom.simplemachines.org/mods/index.php?mod=3844
5.http://custom.simplemachines.org/mods/index.php?mod=3868
6.http://custom.simplemachines.org/mods/index.php?mod=3934
7.http://www.thaiseoboard.com/index.php?topic=355956.0
« แก้ไขครั้งสุดท้าย: 25 ธันวาคม 2014, 20:47:43 โดย WACHIRAPILAN » บันทึกการเข้า
Meaw-IE
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 345
ออฟไลน์ ออฟไลน์

กระทู้: 2,171



ดูรายละเอียด
« ตอบ #1 เมื่อ: 22 ธันวาคม 2014, 22:31:45 »

 Shocked เยอะมากๆ ขอบคุณครับ
บันทึกการเข้า

songpra
Newbie
*

พลังน้ำใจ: 12
ออฟไลน์ ออฟไลน์

กระทู้: 98



ดูรายละเอียด เว็บไซต์
« ตอบ #2 เมื่อ: 22 ธันวาคม 2014, 23:30:50 »

ขอบคุณมากครับ ข้อมูลดี ๆ wanwan044
บันทึกการเข้า
rock4u
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 100
ออฟไลน์ ออฟไลน์

กระทู้: 1,508



ดูรายละเอียด
« ตอบ #3 เมื่อ: 23 ธันวาคม 2014, 00:12:03 »

ขอบคุณครับ
บันทึกการเข้า

Minnymouse
ก๊วนเสียว
*

พลังน้ำใจ: 12
ออฟไลน์ ออฟไลน์

กระทู้: 325



ดูรายละเอียด
« ตอบ #4 เมื่อ: 23 ธันวาคม 2014, 02:49:34 »

เยี่ยมจุง  Embarrassed
บันทึกการเข้า

baby-bride
สมุนแก๊งเสียว
*

พลังน้ำใจ: 28
ออฟไลน์ ออฟไลน์

กระทู้: 543



ดูรายละเอียด เว็บไซต์
« ตอบ #5 เมื่อ: 23 ธันวาคม 2014, 09:19:09 »

ขอเก็บก่อนครับ
บันทึกการเข้า

smileCM77
ก๊วนเสียว
*

พลังน้ำใจ: 27
ออฟไลน์ ออฟไลน์

กระทู้: 336



ดูรายละเอียด เว็บไซต์
« ตอบ #6 เมื่อ: 23 ธันวาคม 2014, 09:25:28 »

สุดยอดครับ ขอคาราวะ
 wanwan017
บันทึกการเข้า

romance69
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 169
ออฟไลน์ ออฟไลน์

กระทู้: 2,159



ดูรายละเอียด เว็บไซต์
« ตอบ #7 เมื่อ: 23 ธันวาคม 2014, 09:44:11 »

ขอบคุณมากครับ ^__^
บันทึกการเข้า
amazegu
สมุนแก๊งเสียว
*

พลังน้ำใจ: 80
ออฟไลน์ ออฟไลน์

กระทู้: 875



ดูรายละเอียด
« ตอบ #8 เมื่อ: 23 ธันวาคม 2014, 10:13:37 »

จะว่าไปหลักการสร้าง mod ของ smf คือมีแค่
1.filename ชื่อไฟล์ที่ต้องการจะแก้
2.operation ที่เราจะทำกับไฟล์ที่จะแก้ เช่น search position="xxx" ถ้าจะลบโค้ดนั้นๆก็ใช้ replace ถ้าใช้ before ก็คือว่าโค้ดที่เราจะ add ไว้ก่อนโค้ดนั้นๆ after ก้สลับกันคือวางไว้หลัง
ตรง add ก็คือโค้ดที่เราจะใส่ไปแทนที่หรือตามแต่ position ที่เราต้องการครับ  wanwan003 wanwan003 wanwan003
บันทึกการเข้า
gggcomputer
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 156
ออฟไลน์ ออฟไลน์

กระทู้: 1,553



ดูรายละเอียด เว็บไซต์
« ตอบ #9 เมื่อ: 23 ธันวาคม 2014, 10:59:00 »

ขอบคุณครับผม  wanwan017
บันทึกการเข้า

stylegooni
Newbie
*

พลังน้ำใจ: 0
ออฟไลน์ ออฟไลน์

กระทู้: 9



ดูรายละเอียด
« ตอบ #10 เมื่อ: 23 ธันวาคม 2014, 14:16:16 »

 wanwan017  ขอบคุณค่ะ
บันทึกการเข้า
Lesson
สมุนแก๊งเสียว
*

พลังน้ำใจ: 26
ออฟไลน์ ออฟไลน์

กระทู้: 575



ดูรายละเอียด
« ตอบ #11 เมื่อ: 23 ธันวาคม 2014, 16:31:04 »

ขอบคุณครับ เก็บไว้ๆ wanwan003
บันทึกการเข้า
mymo
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 302
ออฟไลน์ ออฟไลน์

กระทู้: 3,163



ดูรายละเอียด
« ตอบ #12 เมื่อ: 23 ธันวาคม 2014, 18:25:02 »

สุดยอด wanwan003
บันทึกการเข้า

imodxlstep
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 139
ออฟไลน์ ออฟไลน์

กระทู้: 3,387



ดูรายละเอียด เว็บไซต์
« ตอบ #13 เมื่อ: 23 ธันวาคม 2014, 20:19:41 »

Mod คืออะไร ของไปเซิสแป๊บครับ
บันทึกการเข้า

ขายรูปออนไลน์ทั่วโลกกับเว็บไซต์ Shutterstock.com

อยากรวย ไปหาหนังสือนี้มาอ่านนะครัช

เป็นแค่คน ๆ หนึ่ง ซึ่งรักกล้วยไม้  สนใจในกล้วยไม้ เพราะกล้วยไม้เป็นสิ่งที่ธรรมชาติ บรรจงสร้างสรรขึ้นมาเพื่อให้โลกสวยงาม ตื่นเช้ามาก็รดน้ำกล้วยไม้ ใส่ปุ๋ยกล้วยไม้ ผมรักกล้วยไม้...เว็บไซต์กล้วยไม้ TJorchid.com วิธีจ่ายเงินซื้อของ Lazada
fainewroad
คนรักเสียว
*

พลังน้ำใจ: 14
ออฟไลน์ ออฟไลน์

กระทู้: 172



ดูรายละเอียด
« ตอบ #14 เมื่อ: 23 ธันวาคม 2014, 22:24:27 »

สุดติ่งกระดิ่งแมว

ผมเคยเข้าไปหาความรู้เว็ปท่านอยู่

ขอบคุณครับ

 wanwan017
บันทึกการเข้า
freetukyang
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 69
ออฟไลน์ ออฟไลน์

กระทู้: 1,566



ดูรายละเอียด เว็บไซต์
« ตอบ #15 เมื่อ: 24 ธันวาคม 2014, 07:21:40 »

อยากดูตัวอย่าที่ทำแล้วมีไหมึครับ
บันทึกการเข้า

หน้า: [1]   ขึ้นบน
พิมพ์