จากข้างบนให้เราแก้ไขโค๊ดดังต่อไปนี้
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" สร้างโดยผีมือของตัวท่านเองเป็นที่เรียบร้อยไม่ยากเลยใช่ไหมครับ.