Documentation.

Basics Quick Start Guide

Get up and running in just 10 minutes!

Sections

Basics

  1. Quick Start Guide
  2. Quick Start with Node.js
  3. Theming

Development

  1. Server Libraries
  2. Database Backends

Code API

  1. Server-side PHP
  2. Node.js Server
  3. Client-Side Scripts
 

Step One: Extrac­tion and Upload

Go down­load the lat­est ver­sion of Ajax IM; the “Mini­fied” copy should be fine for this guide. Once down­loaded, extract the files to any folder on your computer.

After extrac­tion, con­nect to your FTP server and cre­ate a new folder called ajaxim. Upload all of the Ajax IM files into this folder.

Step Two: Installation

Fol­low the instal­la­tion guide. Be sure to select the “Default” server library, which only requires PHP (if you want to use Node.js, see the Quick Start with Node.js). Once you’ve run the installer, move on to step three.

Step Three: Initialization

Great, you’ve installed Ajax IM! Now what?

Place the load­ing code in the header or footer of your website.

<script type="text/javascript" src="publicpathtoajaxim/js/im.load.js?php"></script>

Note: publicpathtoajaxim should be the pub­licly avail­able path to your Ajax IM instal­la­tion, e.g. /ajaxim.

Place this code on your web­site, either in the <head> sec­tion or before </body> (fre­quently in a header or footer file). It will auto­mat­i­cally load any nec­es­sary libraries (jQuery, etc.) and the main Ajax IM script, im.js. Addi­tion­ally, it will auto­mat­i­cally ini­tial­ize the Ajax IM class for you.

You can find out more about the indi­vid­ual ini­tial­iza­tion options by read­ing the im.js doc­u­men­ta­tion.

Step Four: Allow­ing users to reg­is­ter and login

Now that the IM library will auto­mat­i­cally load on your web­site, you’ll need a way to allow users to login and reg­is­ter. For­tu­nately, Ajax IM pro­vides a very sim­ple function/widget that will han­dle this for you.

To insert a login/registration form, first add the code <div id="ajaxim"></div> some­where on your site.

Below that <div> ele­ment, add the fol­low­ing code

<script type="text/javascript">
    AjaxIM.loaded(function() { AjaxIM.client.form('#ajaxim'); });
</script>

This AjaxIM.client.form func­tion will auto­mat­i­cally load (from your theme) the login and reg­is­tra­tion forms, and insert them into the “ajaxim” ele­ment. This also means that you can insert this form into any ele­ment you would like; just swap “#ajaxim” for the ele­ment id you’d like to use (be sure to pre­fix it with ‘#’, which denotes that we’re refer­ring to an element’s id).

No Comments Yet

You can be the first to comment!

Leave a comment