Chapter 5. The User Interface Toolkit

Table of Contents

Introducing WacsUI
Including WacsUI support
WacsUI: DescribeHer
The addkeyicons function
WacsUI: Other Functions
Conclusions

Introducing WacsUI

In this chapter, we're going to take a slightly different tack, we're going to just look at code segments you could choose to include within your application, primarily user interface components taken from the User Interface toolkit, WacsUI. This is not going to be an exhaustive review of what is available as that is covered in detail in the reference section, Chapter 7, WACS API: User Interface Module. Instead this is just a quick taster of just a few of the calls provided by the WacsUI toolkit.

So far we've been dealing with the various routines that are provided by the Core Wacs module - and these relate primarily to configuration parameters and security. There is a second module available for you to use called WacsUI, the WACS User Interface Toolkit. This concerns itself primarily with providing utility functions to ease the tasks of formatting and preparing data from the database into a form more suitable for use in web pages.

Including WacsUI support

To include support for the WACS User Interface (WacsUI) toolkit within your application, you need to add the following extra lines to your code, ideally just after the Wacs core module.

Example 5.1. WacsUI initialisation

require_once "wacsui.php";

$wacsui = new WacsUI;

and here's the perl dialect of the same activity...

use WacsUI;

WacsUI: DescribeHer

Example 5.2. Using WacsUI: describeher

print $wacsui->describeher( 
       array( 'hair'=>$results[4],
         'length'=>>results[5],
         'titsize'=>>results[6],
         'pussy'=>>results[7],
         'race'=>>results[8],
         'build'=>>results[9],
         'height'=>>results[10],
         'weight'=>>results[11],
         'occupation'=>>results[12]))."\n";

[Note]Note

We have to package up our parameter list as an array in order to pass it in Php; perl is somewhat simpler with a simple sequence of named parameters.

print describeher(
        hair=>$results[4],
        length=>$results[5],
        titsize=>$results[6],
        pussy=>$results[7],
        race=>$results[8],
        build=>$results[9],
        height=>$results[10],
        weight=>$results[11],
        occupation=>$results[12] )."\n";

The above example is based upon modifying the MySimple example program from in the second chapter to add the following extra fields into the query: mhair, mlength, mtitsize, mpussy, mrace, mbuild, mheight, mweight, moccupation after the mimage (with a comma of course) and before the from clause.

The addkeyicons function

Both the models and sets schemas feature fields that contain a space seperated list of keywords that mark certain attributes found within that set. These can be quickly turned into a small HTML table of icons using the routine addkeyicons. The fields suitable for use with this are scatinfo from the sets table and mattributes from the models table. These are passed as the first attribute; the second being the displayed size of the icons which for the default icons would be a maximum of 48 x 48 pixels. The function is called simply with:

Example 5.3. Using AddKeyIcons

	addkeyicons( $results[16], 24 );

WacsUI: Other Functions

Another example of using the wacsui module can be found in the newsets.php application in the samples directory. This is a more "real world" worked example showing a new releases index page; it makes use of both the iconlink and addkeyicons functions.

Detailed documentation on each call available and how it works can be found in the API reference section Chapter 7, WACS API: User Interface Module.