Text Ads / Announcements Module

Return to the Module Documentation Index

The Idea

Chat administrators can display text messages - site announcements or advertisements, for example - to all users, or only to users of a specific room, or only to users of a specific language.

Setup

Locate the 'config.php' file within FlashChat's 'inc' folder. Open using a good text editor, like Textpad, and be very careful not to introduce PHP errors while editing. Be sure to backup your original config.php file, just in case you need to restore it.

Scroll down to the 'module' settings, and change the 'path' property to match the SWF path of the text ads module. For example, like this:

	 'module' => array(
		'anchor'  => 0,
		'path'    => 'modules/text_ads/text_ads_module.swf',
		'stretch' => true,
		'float_x' => 300, 
		'float_y' => 200, 
		'float_w' => 100, 
		'float_h' => 100, 
	 ),

I recommend that you keep 'anchor' set to 0, and keep 'stretch' set to true. You can ignore float_x, float_y, float_w, and float_h for now. If you change 'anchor' to -1, then you may wish to adjust the float values.

The important thing is to ensure that 'path' is set correctly. If you put the module files in a folder other than "text_ads", or if you recompiled the SWF using a different name, then obviously you'll have to adjust the 'path' value accordingly.

Configuration

This module is configured by editing two external XML files: config.xml and messages.xml. You shouldn't be frighted by the presence of an XML file - it is simply a way to represent textual data in an organized manner. You can add new messages easily by adding new <message> sections in the messages.xml file. Here's what the parts of the <message> section actually mean:

<message> = The start of a new message

<title> = The title of the message. You do not have to place your text within a CDATA[..] enclosure, but this is recommended anyway, just in case you wish to embed simple HTML formatting, like <b> and <i>.

<text> = The actual body of the message. I recommend that you surround the text with CDATA, so that you can use HTML formatting within your message, for example: <![CDATA[Your message goes here! <b>This is bold.</b> <i>This is italic.</i>]]

<rooms> = This tag allows you to create room-specific messages. You must include the full, text name of the room, like "Current Events". To display the same message in two rooms, use a comma to separate the room names, for example: <rooms>The Lounge,Talk</room> If you change the name of a room in the FlashChat admin panel, then you must also change the name of the room in the module XML file.

Now, let's take a look at config.xml... this file contains configuration data which is not directly related to the message content. For example, the module color scheme is specified in this file. If you have the 'stretch' option turned off in config.php, then the module width and height are set using <width> and <height>. Please note that color values should be hexidecimal, web-safe colors of the form 0xRRGGBB.

Please remember to save your config.xml and messages.xml using UTF-8 format.