CTable 1.0
To use CTable, simply create an instance of it, like so:
$table = new CTable();
You will then need to assign the number of rows for the class, this is done using the Rows() method, like so:
$table->Rows(5);
You will also need to define the number of cells for the table, in much the same way you define the Rows, using the Cells() method, like this:
$table->Cells(10);
You can now set the data contained within the cells, like this:
for($x=1;$x<=$table->GetRows(); $x ) {
for($y=1;$y<=$table->GetCells(); $y ) {
$table->SetData("x($x) y($y)", $x, $y);
}
}
The above is a loop that fills each cell in the table with the row and cell number ... the output should look similiar to this:
x(1) y(1) | x(1) y(2) | x(1) y(3)
x(2) y(1) | x(2) y(2) | x(2) y(3)
x(3) y(1) | x(3) y(2) | x(3) y(3)
After you have placed data within the table, you must then Generate() it for it to be displayed on the screen. This is done with the Generate() method, like so:
$table->Generate();
You may additionally free up some memory, by calling the Release() method, like so:
$table->Release();
ADDITIONAL FEATURES:
You may wish to alter the table's class, border, width, cellpadding, cellspacing, or possibly its style attribute. You can do this using either the setHeader() method, or by calling the setClass, setBorder, setWidth, setCellpadding or setCellspacing methods, similiar to this:
$table = new CTable();
// setHeader must be called before any other Header methods
// setHeader rewrites the current Header, this is why!
$table->setHeader('style="border: thin solid red"');
$table->setCellspacing(5);
$table->setCellpadding(0);
$table->setBorder(1);
$table->Rows(5);
$table->Cells(2);
$table->SetData("TEST", 1, 2);
$table->Generate();
$table->Release();
unset($table);
More popular HTML
- Mysql Ajax Table Editor 2.2 (2 years, 5 months 11 days ago)
- Form Tools 2.0.3 (2 years, 6 months 9 days ago)
- PHP Form Builder Class 3.1 (5 months 19 days ago)
- Ajax Table Edit 1.0 (7 years, 8 days ago)
- PHPagination 1.0 (2 years, 6 months 19 days ago)
Listing Files

GenerateTable_Example.php- 5.0 KB
- 10/01/2008 03:53:56

usage.txt- 2.2 KB
- 10/01/2008 03:53:56

CTable.php- 7.8 KB
- 10/01/2008 03:53:56
- FREE MySQL Cloud Database Super Simple, Zero-Management MySQL Cloud DB. Use It FREE!
- Pinterest clone Start your own pin board social network today. Get Pintastic and start your own pinterest clone network.
- MYRE Real Estate Software Professional Real Estate solutions by MYREPHP PROGRAMMING!
