:::

6. 即時聊天系統

一、ajax im(http://old.ajaxim.com)

1.ajax im比較類似MSN,可針對好友僅行即時通訊。
2.將ajax_im_3.41_yui.zip解壓縮到目錄下,如 ajaxim
3.將 config-sample.php 複製一份並改名為 config.php,開啟該檔,設定資料庫。
4.用瀏覽器執行「http://網址/ajaxim/install.php」會自動建立資料庫。
5.接著,刪除install.php ,並執行「http://網址/ajaxim/」即可使用。

二、ajax chat(https://blueimp.net/ajax/)

1.ajax chat比較類似聊天室。相關文件:http://sourceforge.net/apps/mediawiki/ajax-chat/
2.將ajax_chat-0.8.3.zip解壓縮到目錄下,如 chat
3.將 lib/config.php.example 複製一份並改名為 config.php,開啟該檔設定資料庫。
4.用瀏覽器執行「http://網址/chat/install.php」會自動建立資料庫。
5.接著,刪除install.php ,並執行「http://網址/chat/」即可使用。

三、嵌入到網頁中

<script type="text/javascript">
    // <![CDATA[
        function openWindow(url,width,height,options,name) {
            width = width ? width : 800;
            height = height ? height : 600;
            options = options ? options : 'resizable=yes';
            name = name ? name : 'openWindow';
            window.open(
                url,
                name,
            'screenX='+(screen.width-width)/2+',screenY='+(screen.height-height)/2+',width='+width+',height='+height+','+options
            )
        }
    // ]]>
</script>


<a href="chat/" onclick="openWindow(this.href);this.blur();return false;">ajax Chat</a>
|
<a href="ajaxim/" onclick="openWindow(this.href);this.blur();return false;">ajax im</a>

四、ajax chat如何開房間...

1.開啟 lib/class/CustomAJAXChat.php 修改以下兩個函數:
(1) getChannels() 傳回目前使用者所在的房間。
            $this->_channels = array_merge($this->_channels, array('會客室'=>11, '貴賓室'=>22, 'VIP室'=>33));
        }
        return $this->_channels;
    }

(2) getAllChannels() 傳回目前所有可用的房間,不管目前使用者是否在該房間。
            $this->_allChannels = array_merge($this->_allChannels, array('會客室'=>11, '貴賓室'=>22, 'VIP室'=>33));
        }
        return $this->_allChannels;
    }


:::

搜尋

QR Code 區塊

https%3A%2F%2Fwww.tad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D9%26tbdsn%3D260

書籍目錄

展開 | 闔起

線上使用者

17人線上 (4人在瀏覽線上書籍)

會員: 0

訪客: 17

更多…