classAd 4.0 - user manual

Changing the program layout

The layout of ClassAd can be changed easily to meet your website's requirements. This document will show you how to do the customizing. Please keep in mind that you need at least basic knowlege of HTML and CSS to change the layout.

Templates

ClassAd uses a system of HTML templates to display the user requested pages. Basically these templates are skeletons of webpages in which variable / script generated data are inserted. ClassAd differentiates between two kinds of templates: HTML and email templates; this document will describe HTML templates.

Basic skeleton of HTML templates

ClassAd's HTML templates have a basic structure, based on using <div>-areas. This structure makes it possible to create a table-less base design of websites and simplifies the usage of CSS files for display control. Of course you have the possibility to change the base structure to table-based design, if preferred.

By default the basic skeleton is structured like this:

<div id="overall">
	<div id="headtitle">
*** TITLE BLOCK ***
</div>
<div id="headmenu">
*** UPPER MENU ***
</div>
<div id="viewarea"> *** MAIN DISPLAY AREA OF PAGE ***
<div id="viewtitle">
*** TITLE OF DISPLAY AREA
</div>
<div class="breadcrumb">
*** BREADCRUMB ***
</div>
<?php if(isset($strMessage) && !empty($strMessage)) { ?>
*** MESSAGE DISPLAY (IF NECESSARY) *** <?php } ?>
<div class="viewmain">

*** MAIN DISPLAY AREA - ALL FORMS AND TEXTS ARE DISPLAYED HERE *** </div>
<div id="viewfooter"> *** FOOTER OF DISPLAY AREA</div>
</div>
<div id="footer">
*** FOOTER AREA OF THE PAGE ***
</div>
</div>

Modifying templates

Basically ClassAd is designed to display templates by using "include". Before including the template, all necessary variables are created by the calling script (e.g. tables and formatted strings). These variables are embedded into the template by inline PHP commands, similar to <?php echo $strVariable; ?>.

The main advantage of this simple technique is the speed with which these templates are handled - because this is what PHP is build for: a HTML template engine. The disadvantage of this template handling is that there is no real template abstraction.

The template itself can be edited with every HTML editor (e.g. Macromedia Dreamweaver or others) or even a simple text editor. Please make sure that the editor does not change the HTML structure unintentionally - like Microsoft Word or Frontpage.

All templates are located in the /templates-subfolder. There the folder branches out to the various language versions.

As a general rule the template files are named after the scripts they belong to. For consistency reasons template names should not be changed.

Modifying the stylesheet (CSS)

For placement and design of the elements used by ClassAd, CSS is used. This file controls amongst others flow behaviour of the <div> elements which are used in page structuring. Also text sizes, colours, borders, spacing, background and element design are controlled by so-called CSS attributes which influence HTML elements.

The used CSS file can be found in the /styles folder, named classified.css. You can create a new CSS file - best by copying the original file and changing the element characteristics. The configuration file inc/config.inc.php will determine which CSS file will be used.

Customizing language files

ClassAd 4.0 offers two language versions - English and German - in its release version.

To create a new language version is no problem with ClassAd. We would like to explain in short which steps you have to follow:

Maintaining the date format

ClassAd uses the format strings which are specified in the file languages [LANG].php for all displayed date outputs.

LOCAL_DATETIME is used for display of date and time,
LOCAL_DATE is used for display of date only.

For formatting, the enhanced sprintf() format is used which enables the user to change the order of parameters. Date/time parameter are always delivered in the following order:

year (1) - month (2) - day (3) [ hour (4) - minute (5) - second (6) ]

The format string for a date formatted for Germany then is:

define("LOCALE_DATE","%3$02d.%2$02d.%1$04d"); // Displays: 17.01.2006

Maintaining the badlist

The badword filter in ClassAd filters entered texts according to all filter words which are defined in the array $BAD_WORD_LIST in the file languages.[LANG].php. The filter also finds parts of words: has the word "test" been defined as an unwanted word, the word "computertest" will be filtered accordingly.

Edit the badword list so that all unwanted words or parts of words are included; please remember to insert all international insults which are generally comprehensible.

Maintaining the country list

When registering a new user, when insertinf a new display and in other parts within the program, drop down inputs for a country choice are used. This choice is twice-shared - in the upper part are countries which are considered most important; the lower part shows all countries.

When ClassAd was created, this country list was implemented into the file inc/countries.inc.php and not into the language file, for various reasons. There are two arrays in this file: $IMPORTANT_COUNTRIES and $COUNTRIES.

In the associative array $COUNTRIES, country names receive a key which corresponds to the ISO coding of a country. The country names are germanized in part, or in English. The reason for this ostensible inconsistency is that the list is determined by the location of the market and not by the language disposition of the user.

In the second array $IMPORTANT_COUNTRIES, ISO codes of countries are saved which are to be displayed in the upper part of the drop down menu. Countries listed in the upper part are not displayed in the lower part.