Banner image

Chat Technical Help - Server

Problems with the chat

The chat needs a database connection and associated tables etc., If the chat is not working properly, for example you post a message but it doesn't get posted to the chat, Click here

Adding Chat to pages

The chat is included as part of a biscuits release. /home/leonwool/public_html/biscuits-12y/chat
  1. Switch on the chat by adding this to your config.php You have a separate config file for the chat configuration/chat-config.php

    $this->chat = TRUE; This results in a chat sleeper bar on the footer that can be opened up by clicking on it.

    Chat is currently installed public_html/biscuits-12y/chat

  2. The chat requires some HTML. Your outer template can check whether $this->chat is TRUE and load this HTML by
    include CHAT_ROOT . '/html/container.php';
  3. Chat Javascript and CSS If you view the source code for a page containing the chat, you should find:
    1. a javascript file biscuits-chat.js

      Some browsers will open this file if you click on it. This confirms that the script is linked properly to the page.

    2. a CSS file biscuits-chat.css

      This CSS styles the chat - For example the sleeper bar will be positioned at the foot of the page.

    Biscuits engine chat loading code

    All handled automatically by the main biscuits engine. Just set this->chat = true; Both the biscuits-chat.js file and the biscuits-chat.css file must be loaded in the page.

    if ($this->chat) {
      $this->addJS(WEB_CHAT_ROOT . '/js/biscuits-chat.js', true);
      $this->addCSS(WEB_CHAT_ROOT . '/css/biscuits-chat.css', true);
      $this->addReadyCode("setChat('" . WEB_CHAT_ROOT . "');");
    }

    Check your page source code now

  4. On page load Setup
    The final component is a setup javascript which you should have in document.ready() called setChat()

Ajax (jQuery) Chat

First of all. The main point to note in the new chat version is that everything is done by ajax. That means that javascript in biscuits-chat.js links through ajax to ajax-chat.php and the class chatMethods.php

Software Components

How the Chat opens

  1. If the chat is installed, it can be started by clicking on the sleeper bar at the base of the page. This starts a js function chatToggle();
  2. This calls JS chatStart();
  3. This uses ajax to run PHP ajax-chat.php
    Since ajax-php is loaded into a visible area to show chat messages, we can debug it by simple echo statements. Just be aware that if the PHP script ajax-chat.php contains errors,it may not be successfully loaded by ajax.
  4. Various application configuration settings are passed via post method into the PHP , such as memberDB class and the DB connection parameters.

Testing Notes

iBiscuits LOGO

380 memberDB.php INSERT INTO et_page_visits ( vuid,vpage,vreferrer,vtime,vlang,vagent,vbot,vversion,vguest,vip) VALUES ( "1","http://englishtap.com/help/chat","Unknown","1534483992","","CCBot/2.0 (https://commoncrawl.org/faq/)","","biscuits-12y","","54.161.49.216") ON DUPLICATE KEY UPDATE vuid = "1" ,vpage = "http://englishtap.com/help/chat" ,vreferrer = "Unknown" ,vtime = "1534483992" ,vlang = "" ,vagent = "CCBot/2.0 (https://commoncrawl.org/faq/)" ,vbot = "" ,vversion = "biscuits-12y" ,vguest = "" ,vip = "54.161.49.216"
538 engine.php getContent help