วิธีทำรูปเฉพาะให้แต่ละบอร์ด สำหรับ SMF 2.0 RC2
สิงอยู่ใน thaiseoboard มานาน วันนี้ขอเอาความรู้มาแบ่งปันคืนสู่สังคมนะคะ (ไม่ได้เก่งนะคะ แค่อยากแบ่งปันจ้า)
ถ้าใครต้องการทำรูปเฉพาะให้แต่ละบอร์ดใน SMF ทำตามนี้ได้เลยจ้า
(บทความนี้อ้างอิงความรู้จาก 2 แหล่งนี้นะคะ
http://www.dzinerstudio.com/index.php?topic=5390.0 
และ
http://www.zone-it.com/61325 
)
เราหาวิธีทำ แล้วมันต้องปรับนิดหน่อยถึงจะได้อะคะ
เอาละ ทำตามนี้นะคะ
1. เปิดไฟล์ Themes/<theme>/BoardIndex.template.php
หา โค้ด
// If the board or children is new, show an indicator.
if ($board['new'] || $board['children_new'])
echo '
<img src="', $settings['images_url'], '/', $context['theme_variant'], '/on', $board['new'] ? '' : '2', '.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" />';
// Is it a redirection board?
elseif ($board['is_redirect'])
echo '
<img src="', $settings['images_url'], '/', $context['theme_variant'], '/redirect.png" alt="*" title="*" />';
// No new posts at all! The agony!!
else
echo '
<img src="', $settings['images_url'], '/', $context['theme_variant'], '/off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';
echo '
</a>
</td>
<td class="info">
<a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>';
แล้วแทนด้วย โค้ด
if ($board['new']) {
if (file_exists($settings['theme_dir'] . '/images/on_' . $board['id'] . '.png'))
$board_new_img=$settings['images_url']. '/on_' . $board['id'] . '.png';
else
$board_new_img=$settings['images_url']. '/on.png';
echo '<img src="', $board_new_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';
} elseif ($board['children_new']) {
if (file_exists($settings['theme_dir'] . '/images/on2_' . $board['id'] . '.png'))
$childboard_new_img=$settings['images_url'] . '/on2_' . $board['id'] . '.png';
else
$childboard_new_img=$settings['images_url']. '/on2.png';
echo '<img src="', $childboard_new_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';
} else {
if (file_exists($settings['theme_dir'] . '/images/off_' . $board['id'] . '.png'))
$board_nonew_img=$settings['images_url'] . '/off_' . $board['id'] . '.png';
else
$board_nonew_img=$settings['images_url']. '/off.png';
echo '<img src="', $board_nonew_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';
}
// Is it a redirection board?
if ($board['is_redirect'])
echo '<img src="', $settings['images_url'], '/redirect.png" alt="*" title="*" border="0" />';
echo '</a>
</td>
<td class="windowbg2 info">
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b>';
2. เปิดไฟล์ Themes/<theme>/MessageIndex.template.php
หาโค้ด
// If the board or children is new, show an indicator.
if ($board['new'] || $board['children_new'])
echo '
<img src="', $settings['images_url'], '/' .$context['theme_variant'], '/on', $board['new'] ? '' : '2', '.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" border="0" />';
// Is it a redirection board?
elseif ($board['is_redirect'])
echo '
<img src="', $settings['images_url'], '/' .$context['theme_variant'], '/redirect.png" alt="*" title="*" border="0" />';
// No new posts at all! The agony!!
else
echo '
<img src="', $settings['images_url'], '/' .$context['theme_variant'], '/off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';
echo '
</a>
</td>
<td class="info">
<a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>';
แทนด้วยโค้ด
if ($board['new']) {
if (file_exists($settings['theme_dir'] . '/images/on_' . $board['id'] . '.png'))
$board_new_img=$settings['images_url']. '/on_' . $board['id'] . '.png';
else
$board_new_img=$settings['images_url']. '/on.png';
echo '<img src="', $board_new_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';
} elseif ($board['children_new']) {
if (file_exists($settings['theme_dir'] . '/images/on2_' . $board['id'] . '.png'))
$childboard_new_img=$settings['images_url']. '/on2_' . $board['id'] . '.png';
else
$childboard_new_img=$settings['images_url']. '/on2.png';
echo '<img src="', $childboard_new_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';
} else {
if (file_exists($settings['theme_dir'] . '/images/off_' . $board['id'] . '.png'))
$board_nonew_img=$settings['images_url']. '/off_' . $board['id'] . '.png';
else
$board_nonew_img=$settings['images_url']. '/off.png';
echo '<img src="', $board_nonew_img,'" alt="', $txt['no_icon'], '" title="', $txt['no_icon'], '" border="0" />';
}
// Is it a redirection board?
if ($board['is_redirect'])
echo '<img src="', $settings['images_url'], '/redirect.png" alt="*" title="*" border="0" />';
echo '</a>
</td>
<td class="windowbg2">
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b>';
3. เปิดไฟล์ ./Themes/default/languages/Modifications.english.php
หาโค้ด บรรทัดสุดท้าย
และเติมโค้ดด้านล่างเข้าไปก่อน ?>
$txt['no_icon'] = 'No icon set';
4. เซฟไฟล์ การแก้ไขโค้ดเสร็จเรียบร้อยแล้ว อัพขึ้น server ได้เลย
5. ข้อ 5 นี้ ขอ quote ข้อความของคุณ HoLY CoMM@nDo จาก
http://www.zone-it.com/61325 
มานะคะ
ภาพไอคอนที่จะนำมาแสดงที่บอร์ด
• สร้างภาพขึ้นมา 3 ภาพ ให้มีขนาดเหมาะสมกับบอร์ด โดยมีชื่อไฟล์ดังนี้
... on_ID.gif <-- หมายถึง ภาพที่แสดงว่ามีโพสใหม่ภายในบอร์ดหลัก
... on2_ID.gif <-- หมายถึง ภาพที่แสดงว่ามีโพสใหม่ภายในบอร์ดย่อย
... off_ID.gif <-- หมายถึง ภาพที่แสดงว่าไม่มีโพสใหม่ใดๆเลย
Note1: ID = เลข ID ของบอร์ด (ต้องใส่เป็นเลขจำนวนเต็ม)
Note2: เลข ID ของบอร์ดให้ดูที่ท้ายลิงค์ http://<yoursite>/forum/index.php?board=2.0 แต่ให้ใส่เป็นเลขจำนวนเต็มก็คือ 2
Example: on_2.gif, on2_2.gif, off_2.gif
• นำไฟล์ภาพที่ทำเสร็จแล้วไปวางไว้ที่ Themes/<theme>/images
• เข้าเว็บบอร์ดไปดูผลว่า ภาพที่ทำไว้แสดงผลออกมาหรือไม่? และบอร์ดที่ไม่ได้กำหนดภาพไว้ จะแสดงเป็นภาพไอคอนดั้งเดิมหรือไม่? โดยให้ตรวจสอบทั้งบอร์ดหลักและบอร์ดย่อยเลยนะ ซึ่งถ้าผลออกมาเป็นไปตามที่บอกไว้ ก็เป็นอันเสร็จสิ้นการแสดงภาพไอคอนประำจำบอร์ด
ได้ผลเป็นยังไงบ้างอย่าลืมบอกกันนะคะ

หวังว่าจะเป็นประโยชน์บ้างนะคะ
