acaz โพสต์ 2008-7-5 21:14:02

Popup Chat For Shoutbox

เป็นการสร้างหน้าต่าง Chat ขึ้นมาต่างหากหนึ่งหน้าเพื่อให้การสนทนาเป็นไปอย่างต่อเนื่อง
แต่ความจริงเนตที่ บ. ผมช้า
แล้วผมเข้าเวบจะติดหน้า shoutbox เลยคิดทำขึ้นมาเท่านั้นเอง :lol

ต้องติดตั้ง Shoutbox อยู่ก่อนแล้วนะครับ

1. เปิดไฟลล์ shoutbox.php
ค้นหา
include template('shoutbox_index');
แก้ไขเป็น
include template('shoutbox_popup');
2. แล้วทำการ save as เป็นชื่อ shoutbox_popup.php

3. ไปที่สกินที่คุณใช้งานเปิดไฟลล์ shoutbox_index.htm แล้วทำการ save as เป็นชื่อ shoutbox_popup.htm

4. นำโค๊ดนี้ไปวางที่ shoutbox_popup.htm<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=$charset" />
<title>$navtitle $bbname $seotitle - Powered by Discuz!</title>
$seohead
<meta name="keywords" content="{$metakeywords}$seokeywords" />
<meta name="description" content="$metadescription $bbname $seodescription - Discuz! Board" />
<meta name="generator" content="Discuz! $version" />
<meta name="author" content="Discuz! Team and Comsenz UI Team" />
<meta name="copyright" content="2001-2008 Comsenz Inc." />
<meta name="MSSmartTagsPreventParsing" content="True" />
<meta http-equiv="MSThemeCompatible" content="Yes" />
<link rel="archives" title="$bbname" href="{$boardurl}archiver/" />
$rsshead
$extrahead
<!--{if CURSCRIPT == 'viewthread'}-->
        <link rel="stylesheet" type="text/css" href="forumdata/cache/style_{STYLEID}_viewthread.css" />
        <!--{if $thread['special']}-->
                <link rel="stylesheet" type="text/css" href="forumdata/cache/style_{STYLEID}_special.css" />
        <!--{/if}-->
<!--{elseif CURSCRIPT == 'post'}-->
        <link rel="stylesheet" type="text/css" href="forumdata/cache/style_{STYLEID}_editor.css" />
<!--{/if}-->
<link rel="stylesheet" type="text/css" href="forumdata/cache/style_{STYLEID}_common.css" />
<script type="text/javascript">
        var discuz_uid = $discuz_uid;var IMGDIR = '{IMGDIR}';var attackevasive = '$attackevasive';var gid = 0;var STYLEID = '{STYLEID}';
        <!--{if in_array(CURSCRIPT, array('viewthread', 'forumdisplay'))}-->gid = parseInt('$thisgid');<!--{elseif CURSCRIPT == 'index'}-->gid = parseInt('$gid');<!--{/if}-->var fid = parseInt('$fid');var tid = parseInt('$tid');
</script>
<script type="text/javascript" src="include/javascript/common.js"></script>
</head>
<body>
<!--Shoutbox by ROA-->
<script type="text/javascript" src="include/javascript/prototype.js"></script>
<script type="text/javascript" src="include/javascript/shoutbox.js"></script>
<script type="text/javascript" src="include/javascript/menu.js"></script>
<style type="text/css">
<!--

.shout-button {
        font-size: 11px;
        line-height: 1em;
        display: inline;
        overflow: visible;
        padding: 3px 5px 2px;
        border: 1px solid #CAD9EA;
        background: #FFF;
        cursor: pointer;
        margin-left: 2px;
}
.shout-announce {
        font-size: 12px / 2;
        border: 1px solid #EDEDCE;
        background: #FFFFF2 url(images/default/notice.gif) no-repeat 1em 0.7em;
        padding: 0.5em 1em 0.5em 2.5em;
        margin-bottom: 5px;
        color: #090;
}
.shout-error {
        padding: 4px;
        background-color: #FCC;
        border: 1px solid #C00;
        color: #C00;
}
.shout-membes {
        border-left:1px solid #CAD9EA; background: #FFF url("images/default/portalbox_bg.gif");
        border-bottom: 1px solid #CAD9EA; background: #FFF url("images/default/portalbox_bg.gif");
        background-repeat: repeat-x;
}
-->
</style>
<table border="0" width="790" height="100">
        <tr align="canter">
                <tdvalign="top">
<div class="mainbox">
        <h3>$shout['title']</h3>
        <table summary="shoutbox" cellpadding='0' cellspacing='0'>
                <thead class="category">
               <tr>
                        <th width="80%">Latest Shouts</th>
                        <th width="20%"> Members (<span id="shout_members_total">0</span> Viewing)</th>
               </tr>
                </thead>
                <tr>
                        <td align="left" style="border-bottom: 1px solid #9DB3C5;" valign="top">
                                <div class="shout-announce">กรุณาสนทนาด้วยคำที่สุภาพนะครับ</div>
                                <div style="position:relative">
                                <div id="shout_msg" class="popupmenu_popup" style="height:100px;overflow:auto;"></div>
                                <div id="shout_reloading" style="position:absolute;top:5px;right:18px;display:none"><img src="{IMGDIR}/loading.gif" border="0" alt="Refreshing..." /></div></div>                               
                        </td>
                        <td align="left" class="shout-membes" valign="top">
                                <div id="shout_members"></div>
                        </td>
                </tr>
                <tr>
                        <td>
                                <select id="req_color">
                                        <option value='default' selected="selected">Skin Default</option>
                                        <option value="#000000" style="background-color: #000000">Black</option>
                                        <option value="#a0522d" style="background-color: #a0522d">Sienna</option>               
                                        <option value="#556b2f" style="background-color: #556b2f">DarkOliveGreen</option>
                                        <option value="#006400" style="background-color: #006400">DarkGreen</option>
                                        <option value="#483d8b" style="background-color: #483d8b">DarkSlateBlue</option>
                                        <option value="#000080" style="background-color: #000080">Navy</option>
                                        <option value="#4b0082" style="background-color: #4b0082">Indigo</option>
                                        <option value="#2f4f4f" style="background-color: #2f4f4f">DarkSlateGray</option>
                                        <option value="#8b0000" style="background-color: #8b0000">DarkRed</option>
                                        <option value="#ff8c00" style="background-color: #ff8c00">DarkOrange</option>
                                        <option value="#808000" style="background-color: #808000">Olive</option>
                                        <option value="#008000" style="background-color: #008000">Green</option>
                                        <option value="#008080" style="background-color: #008080">Teal</option>
                                        <option value="#0000ff" style="background-color: #0000ff">Blue</option>
                                        <option value="#708090" style="background-color: #708090">SlateGray</option>
                                        <option value="#696969" style="background-color: #696969">DimGray</option>
                                        <option value="#ff0000" style="background-color: #ff0000">Red</option>
                                        <option value="#f4a460" style="background-color: #f4a460">SandyBrown</option>
                                        <option value="#9acd32" style="background-color: #9acd32">YellowGreen</option>
                                        <option value="#2e8b57" style="background-color: #2e8b57">SeaGreen</option>
                                        <option value="#48d1cc" style="background-color: #48d1cc">MediumTurquoise</option>
                                        <option value="#4169e1" style="background-color: #4169e1">RoyalBlue</option>
                                        <option value="#800080" style="background-color: #800080">Purple</option>
                                        <option value="#808080" style="background-color: #808080">Gray</option>
                                        <option value="#ff00ff" style="background-color: #ff00ff">Magenta</option>
                                        <option value="#ffa500" style="background-color: #ffa500">Orange</option>
                                        <option value="#ffff00" style="background-color: #ffff00">Yellow</option>
                                        <option value="#00ff00" style="background-color: #00ff00">Lime</option>
                                        <option value="#00ffff" style="background-color: #00ffff">Cyan</option>
                                        <option value="#00bfff'" style="background-color: #00bfff">DeepSkyBlue</option>
                                        <option value="#9932cc" style="background-color: #9932cc">DarkOrchid</option>
                                        <option value="#c0c0c0" style="background-color: #c0c0c0">Silver</option>
                                        <option value="#ffc0cb" style="background-color: #ffc0cb">Pink</option>
                                        <option value="#f5deb3'" style="background-color: #f5deb3">Wheat</option>
                                        <option value="#fffacd" style="background-color: #fffacd">LemonChiffon</option>
                                        <option value="#98fb98" style="background-color: #98fb98">PaleGreen</option>
                                        <option value="#afeeee" style="background-color: #afeeee">PaleTurquoise</option>
                                        <option value="#add8e6" style="background-color: #add8e6">LightBlue</option>
                                        <option value="#dda0dd" style="background-color: #dda0dd">Plum</option>
                                </select>
                                <input id="req_message" name="req_message" type="text" size="30" value="" onKeydown="shout_keydown(event)"/>
                                <button class="shout-button" onclick="send_message();">Shout Now</button>
                                <button class="shout-button" onclick="shout_clear()">Clear</button>
                                <button class="shout-button" onclick="shout_refresh()">Refresh</button>
                                <button class="shout-button" id="smilies" onclick="shout_smilies()">Smilies</button>
                                <button class="shout-button" onclick="window.open(this.href='faq.php?action=message&id=18'); return false;">DZ! Codes</button>
                                <div id="smilieslist" class="popupmenu_popup" style="position:absolute; padding:1px; display: none; width:183px;height:auto;"></div>
                        </td>
                </tr>
        </div>
        </table>
        <script language="javascript">
        <!--
        $('req_message').focus();
        // -->
        </script>
</div>
<div id="popup_shoutbox"></div>

<script language="javascript">
        var LastMsg = '';
        var RefreshTime = $shout['refresh'];
        get_members();
        get_messages();
        checker = new PeriodicalExecuter(get_messages, RefreshTime);
</script>
</td>
        </tr>
</table>
</body></html>แล้วบันทึกครับ

5. เปิดไฟลล์ header.htm
ค้นหา<li<!--{if $BASESCRIPT == 'faq.php'}--> class="current"<!--{/if}-->><a href="faq.php">{lang faq}</a></li>แล้วเพิ่มโค๊ดนี้ต่อลงไป
<li><a href="#" onclick="javascript:window.open('shoutbox_popup.php','','height=285,width=790,top=50,left=50,resizable=no,scrollbars=no');">Popup Chat</a></li>
บันทึก และ อัพเดทแคช
หลังจากนั้นหน้ากระดานจะเอา shoutbox ออกหรือเอาไว้เหมือนเดิมก็ได้ไม่มีผล(มั้ง)ครับ
เรียบร้อยครับ :)

Uthen โพสต์ 2008-7-5 22:45:55

เจ๋งไปเลยครับ...ขออนุญาตเอาโค๊ดนี้ไปแปลงใช้กับระบบแชตอื่นๆนะครับ พอดีผมเอา AJAX Chat มาติดตั้งเข้าไว้แล้ว แต่หาวิธีทำเมนูป๊อบอัพไม่ได้.. ทีนี้ใช้ได้แล้วครับ...   ขอบคุณครับผม..

<!--{if $discuz_uid}-->
<li><a href="#" onclick="javascript:window.open('http://www.DomainXX.com/chat/','','height=800,width=790,top=50,left=50,resizable=no,scrollbars=no');">ChatRoom</a></li><!--{/if}-->

mza โพสต์ 2008-7-16 16:30:05

แล๋มๆๆๆ เยี่ยม~(6)~ ~(6)~ ~(6)~

paknampho โพสต์ 2008-8-11 20:53:44

ผมลงแล้ว error แบบนี้อะคับ

Warning: include(/home/www/virtual/narai68.com/htdocs/webboard/./forumdata/templates/1_shoutbox_popup.tpl.php) : failed to open stream: No such file or directory in /home/www/virtual/narai68.com/htdocs/webboard/shoutbox_popup.php on line 162

Warning: include() : Failed opening '/home/www/virtual/narai68.com/htdocs/webboard/./forumdata/templates/1_shoutbox_popup.tpl.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/www/virtual/narai68.com/htdocs/webboard/shoutbox_popup.php on line 162

version 6.0 premod อ่ะคับ
หน้า: [1]
ดูในรูปแบบกติ: Popup Chat For Shoutbox