|
Posted by Marcin Dobrucki on 10/24/06 12:18
Marcin Dobrucki wrote:
>> Does anyone know of a clever way to do this ?
>> I'm afraid my creativity is running a bit dry on this one as the only
>> working way i could come up with so far is to have an if statement before
>> each table cell is created, which is long winded.
>
>
> PEAR::HTML_Table, and then whatever you click inside the cell needs to
> carry some coordinates. After that, its a simple matter of:
Okay, here is some proof-of-concept code to go with the suggestion
(you need PEAR::HTML_Page2 and PEAR::HTML_Table installed):
<?php
require_once('HTML/Page2.php'); // so that we don't need to echo
require_once('HTML/Table.php');
$p = new HTML_Page2();
$t = new HTML_Table(array("frame" => "border",
"rules"=>"all",
"cellpadding" => 10));
for ($i=0; $i<3; $i++) {
for ($j=0; $j<3; $j++) {
$t->setCellContents($i,$j,"<a
href=\"".$_SERVER["PHP_SELF"]."?x=$i&y=$j\">highlight</a>");
}
}
if (isset($_GET["x"])) {
$t->updateCellAttributes($_GET["x"], $_GET["y"],
array("bgcolor" => "pink"));
}
$p->addBodyContent($t);
$p->display();
?>
[Back to original message]
|