LEGACY PAGE WARNING: This page refers to a system or feature that is no longer supported or maintained

Dave Cutting On-Line @ p u r p l e p i x i e . o r g

Rounded Table Project

purplepixie.org: Dave OnLine

Dave's Magic Rounded Table System

Welcome to the home of my rounded table project. I really liked the look of websites that used nice rounded edges on their coloured tables and found it looked much nicer and more professional than just a square block of colour. I hate using graphics packages and certainally don't relish the idea of having to create a total background image of the right size or at least corners of the right size/colour for each table I wish to create.

The answer? A PHP powered solution with one image-generation script which makes JPEG corner images of the right size and colour combined with a PHP library to easily access this. I actually found it amazingly simple to implement and had no real troubles.

As of version 0.01 it only supports white backgrounds though this will change.

Rounded Tables

Hello and Good Morning. You can really put whatever you want here

Hello Again

This is a bigger bevel - size 20

Any Colours You Want

Back to Dave Main

How Does It Work?

There is a PHP script called graphic.php and a library to be used by the pages called rounded.inc.php. Simply put, the rounded.inc.php library contains methods to display rounded tables with various content. The rounded library contains three functions as follows:

function Start_Rnd_Table(fR,fG,fB,Size,TableWidth)
fR, fG and fB are text strings with the Hex colour codes for the table's fill colour in Red, Green and Blue format.
Size is the number of pixels used for the height and width of the corners and TableWidth is a text string used in the table directive for the rounded table (eg "100%"), TableWidth is a default parameter and defaults to 100%. This function begins a rounded table and any text echoed to the screen after it is called before a Finish_Rnd_Table will be displayed in the rounded table.

function Finish_Rnd_Table(fR,fG,fB,Size)
fR, fG and fB is the same colour system as used in Start_Rnd_Table and Size refers to the same measurement. This function closes a rounded table.

function Rounded_Table(Text,R,G,B,Width,Bevel)
R G and B are the Hex RGB values in strings to be used for the table's fill colour. Text is a string containing the content to be placed in the table.

Width is a string for the width of the table and is passed to the Start_Rnd_Table function, it is a default parameter which defaults to 100%. The Bevel is equivilant to the Size parmeters with Start_Rnd_Table and Finish_Rnd_Table, this is a default parameter (default = 5).

Rounded_Table is the more common access-point for a rounded table, usually with the text string being created beforehand and containing various HTML instructions.

Examples of Use

As stated above, the system can be accessed one of two ways. You can start a rounded table, echo the content then finish it or call the Rounded_Table wrapper with a pre-formatted output string. In this example, we will demonstrate both methods.

Example PHP Script Using Rounded Tables:

<?php
require('rounded.inc.php');
$out="<center><h3>Hello World!</h3></center>"; // string for output
$R="A0";
$G="A0";
$B="F0"; // light blue Hex #A0A0F0
Start_Rnd_Table($R,$G,$B,20,"50%"); // Bevel of 20, width 50%
echo $out; // Output our string
Finish_Rnd_Table($R,$G,$B,20); // Finish the Table
echo "<p>";
Rounded_Table($out,$R,$G,$B,"50%",20); // same thing in 1 call
?>

And this Would Produce:

Hello World!

Hello World!

Getting Rounded Rectangle

You are welcome to use this for your own use though I accept no liability for anything ever at all. There is a tarball avalable with the graphic.php, rounded.inc.php and an example.php script.

Download: http://www.purplepixie.org/dave/archive/rounded/roundrect_001.tar.gz

Mirror: http://mirror.purplepixie.org/dave/archive/rounded/roundrect_001.tar.gz

See a Silly Demo of it here

LEGACY PAGE WARNING: This page refers to a system or feature that is no longer supported or maintained