Banner Ads Module

Return to the Module Documentation Index

The Idea

Chat administrators can display rotating banner advertisements to chatters, and tailor the banner ads for specific rooms or languages. For example, if a user logs in using French, then a French banner ad set could be used. German chatters could be presented with German ads, and so on.


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 banner ad module. For example, like this:

	 'module' => array(
		'anchor'  => 0,
		'path'    => 'modules/banner/banner_ad.swf',
		'stretch' => false,
		'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 false. The reason that I suggest using false for the stretch property (in contrast to the other modules, where I typically suggest using true) is that JPG images don't stretch by themselves. And for SWF banners, stretching the banner would probably distort the design, unless the SWF banner is carefully coded. 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 "banner", or if you recompiled the SWF using a different name, then obviously you'll have to adjust the 'path' value accordingly.


This module is configured by editing two external XML files: config.xml and banners.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.

Each <banner> section of banners.xml represents a single banner ad. Let's take a look for a moment at one of these sections:

	<banner src="banners/1.swf" fading="true">
<rooms>Current Events,Hollywood</rooms>

The first line contains the most important parameter: src="..." This is the path, relative to the banners.xml file, of the JPG or SWF file of your banner. Please be VERY careful that you get this path correct. Most web servers ARE case-sensitive; thus, banner.swf is NOT the same as Banner.SWF, which is NOT the same as Banner.swf. To be safe, just stick with lower-case letters for all file names and paths.

The next parameter within the <banner> tag is "fading". If set to "true", then the banners will fade in and out during the rotation. If set to "false", then the transition will not have this fading effect.

<langs> = Indicates which languages this banner should be displayed for. If set to "en,fr,gm" for example, then only English, French, and German users will be able to view this banner. If this parameter is left blank - i.e., left to <langs></langs> - then users of all languages will see the banner. You should use the two-letter language code from the bottom of /inc/config.php.

<rooms> = This determines the rooms of the chat in which the banner will be displayed. You must use the actual text name of the room, like "The Lounge". If this parameter is empty - i.e., left to <rooms></rooms> - then users in all rooms will be able to see the banner. To display a banner in only 2 specific rooms, you should separate the room names with a comma, for example <rooms>The Lounge,Hollywood</rooms>

<skins> = This determines the skins of the chat for which this banner should be displayed. Some might wonder why this parameter was added. The reason is that some banners may be designed with specific graphics that may look better in some skins than others. Most users will leave this XML tag empty - i.e., <skins></skins> However, if you do wish to use this feature, then you should use the skin names that you see in /inc/skins/, for example "xp_skin" or "default_skin". If you wish to display a banner to either of 2 skins, you should separate the skin names with commands, like <skins>xp_skin,aqua_skin</skins>

The config.xml file is very simple for this module... it contains only two parameter, which control the auto-rotation feature. If <active> is set to true, then the banners will automatically rotate. If <active> is set to false, then the banners will not rotate. <time> is the delay time, in seconds, between banners.

IMPORTANT: You might have a situation whereby you have many banners, but the rotation only shows a small number of banners (say, 1 or 2). What's going on? Is the module broken? Most likely, no... the problem could be that you have data in the <rooms>, <langs>, or <skins> tags in the banners.xml file.

For example, you could have 50 banners present in the /banners folder, but if 48 of them have <langs>fr</langs>, and the current user is German, then this user will only see 2 banners at most! Thus, you have to pay very close attention to both banners.xml AND config.xml. The auto-rotation only rotates through the banners that a particular user is capable of viewing, as defined in banners.xml.

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