Location: PHPKode > scripts > finetable > finetable/readme.txt
finetable readme.txt
April 6, 2002

finetable.php is used to produce panels with rounded corners.
It contains the class ftable, which simplifies the calls to
the finetable functions.

To use finetable.php in your php files you include it like this:

     include 'finetable.php';
     
This includes all imperative functions and the class "ftable".
Now both the imperative and the object oriented ways are open.

If you already included an older version and you did include
the class wrapper file, too: Delete the line including the class wrapper:

    include 'ft_class.php'; // <-- Delete this line, it is depreciated

Everything will work as before. If you do not delete this line,
an error will occur.
    
You can put the image delivering files into an extra image
directory, maybe "images". Change these lines after the big comment
in finetable.php:

    $me = 'images/'.IMAGE_GENERATOR;
    $blank = 'images/'.BLANK_IMAGE;

If the files needed to produce the corners and the transparent image
are not there, they will be created if there is write permission.
    
You can hide the files away from the http: path and put them
somewhere in the directory structure of your server:

    $me = '/usr/local/http/includes/'.IMAGE_GENERATOR;
    $blank = '/usr/local/http/includes/images/'.BLANK_IMAGE;

You can rename the files within these define statements:

    define ( 'IMAGE_GENERATOR', 'ft_img2.php' );
    define ( 'BLANK_IMAGE', 'ft_blank.gif' );
    
Finetable will create the files if write permission is given.
If the files are not created, check if the path exists and if you
can get write permission for the path specified.
Check for spelling errors.

You can easily determine if the files are created or not:
look at the corners of the generated panels. If the panels look ok
then the files were created. If the panels look wired, then something
is wrong. 

Download the rescue pack ft_rescue.zip to get the 2 files, if
writing the files does not work.     
     
The class wrapper was added to simplify the approach to finetable
calls. To surround large blocks of code with a finetable, it is
easier to use the class than the pure imperative method.

Here I surround a lot of code with the imperative method:
     
    echo ft_upperhalf( 'Links to pages which use <b>finetable.php</b>', 
         '000000',1,12,'100%','FFCC00','','FFEE00' ); 
     
    ... <a lot of code > ...
    ... at this point, after more than a screen full with code, I
    ... need to scroll up: huh, what was the color? The radius?
    ... now i scroll down again and put this:
      
    echo ft_lowerhalf( 12, 'FFCC00' ); // End of outer Table.         
    
Using the class this would look like this:

    $outer = new ftable;
    $outer->bodybgcolor = 'FFCC00';
    $outer->captionbgcolor = 'FFEE00';
    $outer->linecolor = '000000';    
    $outer->caption = 'Links to pages which use <b>finetable.php</b>';
    $outer->printtop();
    
    ... <a lot of code > ...
    ... at this point, after more than a screen full with code, 
    ... I do not bother at all what was written above. I put this:
    
    $outer->printbottom();
    
Using the class method, a panel can be drawn quickly with:

    $panel = new ftable;
    $panel->printall();

This panel is not empty. It has a caption "Untitled" and a
body who calls "Please give me content!". The corners have
a radius of 12 and the panel's width is '100%'. The colour
is white and the line separating caption and body is one
pixel high and maroon.
To put another caption write:

    $panel->caption = 'This is another caption';
    $panel->printall();

The same ftable-object can be drawn as often as you like.
Now lets put some other text into the panel:

    $panel->bodytext = 'Finally, I have content.';
    $panel->printall();    

You can go on and modify all other values. Change the background
colour of the caption with

    $panel->captionbgcolor = '00FFFF'; // cyan
         
Every variable needed has a default value. The defaults are:

    var $captiontext = 'Untitled'; // some text
    var $captionbgcolor = 'FFFFFF'; // white
    
    var $bodytext = 'Please give me content!'; // some more text
    var $bodybgcolor = 'FFFFFF'; // white
    
    var $linecolor = '800000'; // maroon
    var $lineheight = 1;
    
    var $width = '100%';
    var $radius = 12;
    var $summary = ''; // <table> - summary needed for blind people
        
The colours must be given in a hex-string as shown above. It is 
NOT possible to use 'white' instead of 'FFFFFF'. 
To find out color values you can use my "Farbmischer" (colour mixer) at

    http://www.knito.de/besserwisser/farbmisch.php3

If you followed the above example you noticed, that all panels
hang together. A separating space would be fine. A <br> tag often
is too fat. In finetable.php, there are two functions for that.
ft_blank( $width, $height) generates a string calling the image defined
in $blank. blanker( $width, $height ) echoes this string immediately.
To have vertically separated panels in the example from above, write:
    
    include 'finetable.php';

    $panel = new ftable;
    $panel->printall();
    
    blanker( 100,4 );
    
    $panel->caption = 'This is another caption';
    $panel->printall();
    
    blanker( 100,4 );
    
    $panel->bodytext = 'Finally, I have content.';
    $panel->printall();
    
    blanker( 100,4 );    
        
    $panel->captionbgcolor = '00FFFF'; // cyan
    $panel->width = '50%';
    $panel->printall();

I hope this informations concerning finetable are useful.

Knito, April 8, 2002    
Return current item: finetable