<< วิธีติดตั้ง Shoutbox แบบ Step-by-Step >>
เขียนโดย คุณ TinaCat (2005)
 
SMF ที่ใช้ประกอบบทความ: SMF 1.1 RC2
Mod:  Ultimate Shoutbox v1.37
http://mods.simplemachines.org/index.php?mod=22 



(รูปในช่วงแรกนี้จะไม่มีแล้ว  แต่เท่าที่อ่านๆดูก็ยังทำความเข้าใจได้  เลยไม่ได้ทำรูปมาเสริม / เซียวเหล่งนึ่ง)


เมื่อโหลด Mod (shout_v1.37.tar.gz) มาแล้ว
ไปที่หน้า Download Package ในหน้าผู้ดูแล

ขั้นแรก  เมื่อเข้าหน้า Download Package อาจจะเจอแบบนี้
(ในกรณีที่โฟลเดอร์ Packages บนโฮสต์ไม่ได้ CHMOD เป็น 777)

ให้ใส่ข้อมูลต่างๆของ FTP เราไป  เพื่อให้บอร์ด Connect FTP ได้
Path SMF ต้องเป็น Path ตามที่เห็นในโปรแกรม FTP Client ของคุณนะ  (อาจจะไม่ใช่ Path เต็มๆ)


เสร็จแล้วเลือกอัพโหลด Mod จากเครื่องเราส่งขึ้นโฮสต์
(อัพทั้งไฟล์ .tar.gz เลย  ไม่จำเป็นต้องแตกไฟล์ก่อนอัพ)

เสร็จแล้วคลิกที่ บันทึก Mod

ถ้าไม่ผิดพลาด  จะแสดงรายละเอียดของ Mod Shoutbox ให้เห็น
อ่านรายละเอียดตรงนี้ให้ดีๆ  (หลายท่านไม่ชอบอ่าน  คลิกๆอย่างเดียว  แล้วมีปัญหาก็ไม่รู้สาเหตุ)
เสร็จแล้วคลิกที่ ติดตั้งเดี๋ยวนี้

ถ้าหากว่าไม่มีปัญหา  ก็จะนับว่าติดตั้ง Shoutbox เรียบร้อยแล้ว
แต่ส่วนใหญ่จะมีปัญหาคือ  ในบอร์ดแจ้งว่า ติดตั้งเสร็จสิ้นแล้ว
แต่จริงๆแล้วไม่ได้มีการแก้ไขโค้ดในไฟล์ใดๆให้เลย
วิธีแก้ไขให้ใช้งาน Shoutbox ได้  ก็ดูต่อไปด้านล่างนะ




วิธีติดตั้ง Shoutbox เอง


แตกไฟล์ shout_v1.37.tar.gz ออกมา
แล้วเปิดไฟล์ shoutbox_v1.37.mod ด้วย Notepad
อ่านโค้ดการติดตั้ง Mod จากไฟล์นี้  (ขอให้พยายามอ่านให้ดีๆทุกบรรทัดนะ)
<edit file>
$boarddir/index.php
</edit file>


ส่วนนี้หมายถึงให้แก้ไขไฟล์ index.php
<search for>
'calendar' => array('Calendar.php', 'CalendarMain'),
</search for>


หาโค้ด
'calendar' => array('Calendar.php', 'CalendarMain'),
<add after>
'delete_all_shouts' => array('shout.php', 'delete_all_shouts'),
'delete_shout_age' => array('shout.php', 'delete_shout_age'),
'delete_shout' => array('shout.php', 'delete_shout'),
</add after>


เพิ่มโค้ด
'delete_all_shouts' => array('shout.php', 'delete_all_shouts'),
'delete_shout_age' => array('shout.php', 'delete_shout_age'),
'delete_shout' => array('shout.php', 'delete_shout'),
 

ต่อท้ายโค้ดที่หาออกมาได้  
<edit file>
$sourcedir/Subs.php
</edit file>


แก้ไขไฟล์ Sources/Subs.php
<search for>
log_error('Copyright removed!!');
}
}
</search for>


เพิ่มโค้ดต่อท้าย
<add after>
function smfshout()
{
global $sourcedir;

include_once("$sourcedir/shout.php");
shout_display(true);
}

</add after>


แก้ไขไฟล์ Sources/ModSettings.php
<edit file>
$sourcedir/ModSettings.php
</edit file>

<search for>
'karma' => 'ModifyKarmaSettings',
</search for>


เพิ่มโค้ดต่อท้าย
<add after>
'shout' => 'ModifyShoutboxSettings',
</add after>

<search for>
'layout' => array(
'title' => $txt['mods_cat_layout'],
'href' => $scripturl . '?action=featuresettings;sa=layout;sesc=' . $context['session_id'],
),
</search for>


เพิ่มโค้ดต่อท้าย
<add after>
'shout' => array(
'title' => $txt['shoutbox_0'],
'href' => $scripturl . '?action=featuresettings;sa=shout;sesc=' . $context['session_id'],
),
</add after>

<search for>

function ModifyKarmaSettings()
</search for>


เพิ่มโค้ดไว้ก่อนหน้าส่วนนี้
<add before>

function ModifyShoutboxSettings()
{
global $txt, $scripturl, $context, $settings, $sc;

$config_vars = array(
array('check', 'shout_enableXML'),
array('text', 'shoutlimit'),
array('text', 'shoutsep'),
array('text', 'shoutmaxchr'),
array('text', 'shoutsplitchr'),
array('check', 'shout_noGuestEmail'),
array('select', 'shoutdir', array(
'1' => &$txt['shoutbox_19'],
'0' => &$txt['shoutbox_20'],
)),
array('check', 'enablearchiveshout'),
array('check', 'enablescrollshout'),
array('text', 'shoutscrollwidth'),
array('text', 'shoutscrollheight'),
array('text', 'shoutscrolldelay'),
array('select', 'shoutscrolldir', array(
'up' => &$txt['shoutbox_37'],
'down' => &$txt['shoutbox_38'],
'left' => &$txt['shoutbox_39'],
'right' => &$txt['shoutbox_40'],
)),
array('select', 'shoutscrollspeed', array(
'1' => &$txt['shoutbox_31'],
'2' => &$txt['shoutbox_32'],
'3' => &$txt['shoutbox_33'],
'4' => &$txt['shoutbox_34'],
'5' => &$txt['shoutbox_35'],
)),
);

// Saving?
if (isset($_GET['save']))
{
saveDBSettings($config_vars);
redirectexit('action=featuresettings;sa=shout');
}

$context['post_url'] = $scripturl . '?action=featuresettings2;save;sa=shout';
$context['settings_title'] = $txt['shoutbox_0'];

prepareDBSettingContext($config_vars);
}
</add before>


แก้ไขไฟล์ Themes/default/languages/Modifications.eng.php
<edit file>
$languagedir/Modifications.english.php
</edit file>

<search for>
?>
</search for>


เพิ่มโค้ดไว้ก่อนหน้าส่วนนี้
<add before>
//text for Ultimate Shoutbox
$txt['shoutbox_0'] = 'Shoutbox';
$txt['shoutbox_1'] = 'Shoutbox Archive';
$txt['shoutbox_2'] = 'Delete shouts older than:';
$txt['shoutbox_3'] = 'days';
$txt['shoutbox_4'] = 'Delete all shouts over your current limit of';
$txt['shoutbox_5'] = 'Delete';
$txt['shoutbox_6'] = 'Name';
$txt['shoutbox_7'] = 'Email';
$txt['shoutbox_8'] = 'Message';
$txt['shoutbox_9'] = 'Shout';
$txt['shoutbox_10'] = 'Sorry, if you are a guest you must enter both your name and your email address';
$txt['shoutbox_11'] = 'Whoops, looks like you forgot to fill in one of the Shoutbox fields.  Please try again.';
$txt['shoutbox_12'] = 'Sorry, if you are a guest you must enter a valid email address when using the Shoutbox.';
$txt['shoutbox_13'] = 'Sorry, but you do not have the proper priveledges to delete that.';
$txt['shoutdir'] = 'Shout Direction';
$txt['shoutbox_19'] = 'Ascending';
$txt['shoutbox_20'] = 'Descending';
$txt['shoutsep'] = 'Shout Separator';
$txt['enablearchiveshout'] = 'Allow people to shout from the archive page?';
$txt['shoutlimit'] = 'Number of shouts to return';
$txt['shoutmaxchr'] = 'Max number of characters per line';
$txt['shoutsplitchr'] = 'Character number to split long words at (usually 3 less than max)';
$txt['enablescrollshout'] = 'Enable scrolling';
$txt['shoutbox_27'] = 'The following options are only available is scrolling is activated:';
$txt['shoutscrollwidth'] = 'Scroll box width (pixels)';
$txt['shoutscrollheight'] = 'Scroll box height (pixels)';
$txt['shoutscrollspeed'] = 'Scrolling speed';
$txt['shout_noGuestEmail'] = 'Don\'t require email address for guests';
$txt['shout_enableXML'] = 'Enable javascript XML refreshing of the shoutbox. (This will increase server load)';
$helptxt['shout_enableXML'] = 'Turning on this option will make the shoutbox refresh automatically every five seconds - but will increase the server load considerably.';
$txt['shoutbox_31'] = 'slowest';
$txt['shoutbox_32'] = 'slower';
$txt['shoutbox_33'] = 'medium';
$txt['shoutbox_34'] = 'faster';
$txt['shoutbox_35'] = 'fastest';
$txt['shoutscrolldir'] = 'Scrolling direction';
$txt['shoutbox_37'] = 'up';
$txt['shoutbox_38'] = 'down';
$txt['shoutbox_39'] = 'left';
$txt['shoutbox_40'] = 'right';
$txt['shoutscrolldelay'] = 'Scroll Delay (milliseconds - normal is 60)';
$txt['shoutbox_42'] = 'Delete Options';
$txt['shoutbox_43'] = 'View All';
$txt['permissiongroup_shout'] = 'Shoutbox';
$txt['permissionname_make_shout'] = 'Can Shout';
$txt['permissionname_delete_shout'] = 'Can Delete Shouts';
$txt['shout_delete_selected'] = 'Delete Selected';
$txt['cannot_delete_shout'] = 'You do not have permission to delete shouts.';
$txt['cannot_make_shout'] = 'You do not have permission to shout.';
</add before>


** ส่วนที่มีการแก้ไขในโฟลเดอร์ languages จะเป็นการแสดงผลเกี่ยวกับภาษา
ถ้าแก้ไขไฟล์ Modifications.eng.php แล้ว
ก็ต้องตามไปแก้ไขไฟล์ Modifications.thai.php ด้วยตัวเองอีกรอบ

(Mod ส่วนใหญ่เค้าทำมาให้แต่ภาษาอังกฤษ  เราต้องไปเพิ่มเติมภาษาไทยเอง)



แก้ไขไฟล์ SSI.php
 
<edit file>
$boarddir/SSI.php
</edit file>

<search for>
?>
</search for>


เพิ่มโค้ดไว้ก่อนหน้าส่วนนี้
 
<add before>
function ssi_shout($showform = true)
{
global $sourcedir;

include_once("$sourcedir/shout.php");
shout_display($showform);
}
</add before>


แก้ไขไฟล์ [b]ssi_examples.php
<edit file>
$boarddir/ssi_examples.php
</edit file>

<search for>
<hr />

<h3>Some notes on usage</h3>
</search for>

<add before>
<h3>Shoutbox: &lt;?php ssi_shout(); ?&gt;</h3>
<?php ssi_shout(); ?>

<hr />
</add before>


แก้ไขไฟล์ ssi_examples.shtml
<edit file>
$boarddir/ssi_examples.shtml
</edit file>

<search for>
<h3>Recent Calendar Events Function: &lt;!--#include virtual="./SSI.php?ssi_function=recentEvents" --&gt;</h3>
<!--#include virtual="./SSI.php?ssi_function=recentEvents" -->

<hr />
</search for>

<add after>
<h3>Shoutbox Function: &lt;!--#include virtual="./SSI.php?ssi_function=shout" --&gt;</h3>
<!--#include virtual="./SSI.php?ssi_function=shout" -->

<hr />
</add after>


แก้ไขไฟล์ Sources/ManagePermissions.php
<edit file>
$sourcedir/ManagePermissions.php
</edit file>

<search for>
'pm' => array(
'pm_read' => false,
'pm_send' => false,
),
</search for>

<add after>
'shout' => array(
'make_shout' => false,
'delete_shout' => false,
),
</add after>



วิธีแสดงผล Shoutbox ไว้หน้าบอร์ด

วิธีนี้จะเป็นการใช้ Frame นะ
วิธีทำก็คล้ายๆการแสดงกระทู้ล่าสุดไว้ที่หน้าแรกเว็บ ไซต์
สร้างไฟล์ shoutbox.php ขึ้นมา  และดูต่อที่กระทู้นี้นะ


~ วิธีการแสดงกระทู้ล่าสุดไว้ที่หน้าแรกเว็บไซต์ ~
(อันนี้แปะโป้งไว้ก่อน  ไว้หากระทู้เก่าเจอแล้วจะมาทำลิงก์ให้ /เซียวเหล่งนึ่ง)


แต่โค้ดที่เราจะใช้งานคืออันนี้ค่ะ
<?php ssi_shout(); ?>


อัพไฟล์ shoutbox.php ไปไว้ในโฟลเดอร์ฟอรั่มของคุณ


Shout จะอยู่ด้านล่างของบอร์ด
ให้แก้ไขไฟล์ BoardIndex.template.php ตามน

หาโค้ด
echo '
</table>
</div>
</div>';
}

?>


แก้ไขเป็น
// ----------*** เพิ่ม Chat Box ในส่วนล่างของบอร์ด ***----------
echo '
</table>
</div></div><br />';

echo '
<table border="0" width="100%" cellspacing="1" cellpadding="5" class="bordercolor" style="margin-top: 1px;">
<div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' : '', '>
<div class="catbg" style="padding: 6px; vertical-align: middle; text-align: center; ">
<a href="#" onclick="shrinkHeaderIC(!current_header_ic); return false;"><img id="upshrink_ic" src="', $settings['images_url'], '/', empty($options['collapse_header_ic']) ? 'collapse.gif' : 'expand.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin-right: 2ex;" align="right" /></a>
', $txt['justchatbox'], '
</div>
<div class="windowbg2" style="padding: 6px; ">
<iframe name="I1" width="100%" align="center" border="0" frameborder="0" src="shoutbox.php" height="200" target="_blank">
               Your browser does not support inline frames or is currently configured not to display inline frames.
               </iframe>
</div>
</div>
</table>';

}

?>
 
29 กุมภาพันธ์ 2008