Location: PHPKode > scripts > PHP GUI API > examples/table.php
<?php

$table = new Table("table1");
$table->setAlign(new Align("center", "middle"));
$table->setForeground(new Color("#0000FF"));
$table->setBackground(new Color("yellow"));
$table->setWidth(500);
$table->setCollapsed(TRUE);

$headers = array("Column 1", "Column 2", "Column 3", "Column 4", "Column 5");
$row0 = new TRow;
$row0->fill($headers);
$row0->setForeground(new Color("orange"));
$row0->setBackground(new Color("purple"));

$cell11 = new TCell("Cell 1");
$cell12 = new TCell("Cell 2");
$cell12->setForeground(new Color("pink"));
$cell12->setBackground(new Color("navy"));
$cell13 = new TCell("Cell 3");
$cell14 = new TCell("Cell 4");
$cell14->setForeground(new Color("silver"));
$cell14->setBackground(new Color("brown"));
$cell15 = new TCell("Cell 5");

$row1 = new TRow;
$row1->setAlign(new Align("left", "top"));
$row1->add($cell11);
$row1->add($cell12);
$row1->add($cell13);
$row1->add($cell14);
$row1->add($cell15);

$cell2 = array(new TCell("Cell 6"), new TCell("Cell 7"), new TCell("Cell 8"), new TCell("Cell 9"), new TCell("Cell 10"));
$row2 = new TRow;
$row2->setAlign(new Align("right", "bottom"));
$row2->setForeground(new Color("red"));
$row2->setBackground(new Color("#000000"));
$row2->fill($cell2);

$cell3 = array("Cell 11", "Cell 12", "Cell 13", "Cell 14", "Cell 15");
$row3 = new TRow;
$row3->fill($cell3);

$cell4 = array("Cell 16", "Cell 17", "Cell 18", "Cell 19", "Cell 20");
$cell5 = new ArrayObject(array("Cell 21", "Cell 22", "Cell 23", "Cell 24", "Cell 25"));
$row4 = new TRow;
$row4->fill($cell4);
$row4->setForeground(new Color("#FFFFFF"));
$row4->setBackground(new Color("green"));
$row5 = new TRow;
$row5->fill($cell5);

$cell6 = array(new Link(new URL("http://www.youtube.com"), new Image("http://www.iinuu.eu/images/icons/youtube.png")), 
               new Image(new URL("http://www.sackitchens.com/images/logos/facebook-icon-tw_40x40.gif")),
               new Image(new URL("http://www.tales-of-the-ts.com/wp-content/uploads/2012/02/twitter_icon_40x40.png")),
               new Image("https://www.prevencion10.es/site-web/images/rss-icon-40x40_external.png"),
               new Button("Submit", "submit"));
$row6 = new TRow;
$row6->fill($cell6);

$table->add($row0);
$table->add($row1);
$table->add($row2);
$table->add($row3);
$table->fill(array($row4, $row5));
$table->add($row6);
echo $table->render();

?>
Return current item: PHP GUI API