ciao e grazie , comunque uguale non m ' incrementa i dati , poi con le classi ho iniziato a studiarle da poco , se mi daresti una mano per favore ho un po ritoccato un po la classe cosiRocco ChioloCodice PHP:
error_reporting(E_ALL);
class phpHtml
{
var $tabid = "" ;
var $cellpadding = "" ;
var $cellspacing = "" ;
var $tableborder = "" ;
var $width = "" ;
var $tbclass = "" ;
var $style = "" ;
var $tabtitle = "" ;
var $cssFilePath = "";
var $trclass = "" ;
var $trtitle = "" ;
var $onmouseover = "" ;
var $onmouseout = "" ;
var $onclick = "" ;
var $trid = "" ;
var $trstyle = "" ;
var $colHead = array();
var $colSet = array();
function setTableFormat($tabid = "", $cellpadding = "", $cellspacing = "", $tableborder = "", $width = "", $tbclass = "", $style = "", $tabtitle = "")
{
$this->tabid = $tabid;
$this->cellpadding = $cellpadding;
$this->cellspacing = $cellspacing;
$this->tableborder = $tableborder;
$this->width = $width;
$this->tbclass = $tbclass;
$this->style = $style;
$this->tabtitle = $tabtitle;
}
function setTableTr($trclass ="", $trtitle ="", $onmouseover ="", $onmouseout ="", $onclick ="", $trid ="", $trstyle ="")
{
$this->trclass = $trclass;
$this->trtitle = $trtitle;
$this->onmouseover = $onmouseover;
$this->onmouseout = $onmouseout;
$this->onclick = $onclick;
$this->trid = $trid;
$this->trstyle = $trstyle;
}
function printTableHeader()
{
echo '<table id = "'.$this->tabid.'" cellpadding = "'.$this->cellpadding.'" cellspacing = "'.$this->cellspacing.'" border = "'.$this->tableborder.'" width = "'.$this->width .'" class = "'.$this->tbclass.'" style = "'.$this->style.'" title = "'.$this->tabtitle.'">'."\n";
if(count($this->colHead)>0)
{
echo "<thead>\n";
echo "<tr>\n";
if(count($this->colHead)>0)
{
echo '<td class="tcat" width="4" align="left" nowrap>[img]space.gif[/img]</td>'."\n";
}
for($ii=0; $ii<count($this->colHead); $ii++)
{
echo '<td ';
if(!empty($this->colHead[$ii]['id'])) echo ' id = "'.$this->colHead[$ii]['id'].'"';
if(!empty($this->colHead[$ii]['class'])) echo ' class = "'.$this->colHead[$ii]['class'].'"';
if(!empty($this->colHead[$ii]['width'])) echo ' width = "'.$this->colHead[$ii]['width'].'"';
if(!empty($this->colHead[$ii]['height']))echo ' height = "'.$this->colHead[$ii]['height'].'"';
if(!empty($this->colHead[$ii]['colspan']))echo ' colspan = "'.$this->colHead[$ii]['colspan'].'"';
if(!empty($this->colHead[$ii]['align'])) echo ' align = "'.$this->colHead[$ii]['align'].'"';
if(!empty($this->colHead[$ii]['valign']))echo ' valign = "'.$this->colHead[$ii]['valign'].'"';
echo ' nowrap>';
echo $this->colHead[$ii]['title'];
echo '</td>'."\n";
}
echo '</tr>'."\n";
echo '</thead>'."\n";
}
}
function printTableHeaderContent()
{
$this->printTableHeader();
if(count($this->colHead) > 0){
echo '<tbody><tr><td class="contenttableborder" colspan="'. (count($this->colHead)+1) .'"><table border="0" cellpadding="3" cellspacing="1" width="100%">'."\n";
}else{
echo '<tr><td class="contenttableborder" colspan="'. (count($this->colHead)+1) .'"><table border="0" cellpadding="3" cellspacing="1" width="100%">'."\n";
}
}
function printTableFotter()
{
echo '</table>'."\n";
}
function printTableFotterContent()
{
if(count($this->colHead)>0){
echo '</table></td></tr></tbody></table>';
}else{
echo '</table></td></tr></table>';
}
}
function printDataContent()
{
$count = 0;
$style = ($count % 2 == 0) ? "row1" : "row2";
if(!empty($this->trclass)){
$background = $this->trclass;
}else{
$background = $style;
}
echo '<tr class="'.$background.'" ';
if(!empty($this->trtitle))echo ' title="'.$this->trtitle.'"';
if(!empty($this->onmouseover))echo ' onmouseover="'.$this->onmouseover.'"';
if(!empty($this->onmouseout))echo ' onmouseout="'.$this->onmouseout.'"';
if(!empty($this->onclick))echo ' onclick="'.$this->onclick.'"';
if(!empty($this->trid))echo ' id="'.$this->trid.'"';
if(!empty($this->trstyle))echo ' style="'.$this->trstyle.'"';
echo' >';
for($xx=0; $xx<count($this->colSet); $xx++)
{
echo '<td ';
if(!empty($this->colSet[$xx]['id'])) echo ' id = "'.$this->colSet[$xx]['id'].'"';
if(!empty($this->colSet[$xx]['class'])) echo ' class = "'.$this->colSet[$xx]['class'].'"';
if(!empty($this->colSet[$xx]['width'])) echo ' width = "'.$this->colSet[$xx]['width'].'"';
if(!empty($this->colSet[$xx]['height'])) echo ' height = "'.$this->colSet[$xx]['height'].'"';
if(!empty($this->colSet[$xx]['colspan']))echo ' colspan = "'.$this->colSet[$xx]['colspan'].'"';
if(!empty($this->colSet[$xx]['align'])) echo ' align = "'.$this->colSet[$xx]['align'].'"';
if(!empty($this->colSet[$xx]['valign'])) echo ' valign = "'.$this->colSet[$xx]['valign'].'"';
echo '>';
echo $this->colSet[$xx]['value'];
echo '</td>'."\n";
}
echo '</tr>';
$count ++;
}
function printTable()
{
echo '<link href="'.$this->cssFilePath.'" rel="stylesheet" type="text/css">';
$this->printTableHeaderContent();
$this->printDataContent();
$this->printTableFotterContent();
}
}

Rispondi quotando