By: CWL
Date: 2004-11-25
Time: 16:39
|
Dynamical column and alternate colors
Hi,
Actually, I applied the process to get the number of column dynamically,
also I want to alternate the color of each line
for the last one, I just define two identical <TR> section with different color, it doesn't work, just the first line color is displayed.
php code
$nbStat = "2";
$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate('navigateur.html') ;
$date = Array('jour 22', 'jour 23' );
$rec = Array();
$rec[] = Array('NAVIGATEUR'=>'IE','jour 22'=>'0-2', 'jour 23'=>'0-3');
$rec[] = Array('NAVIGATEUR'=>'Opera','jour 22'=>'1-2', 'jour 23'=>'1-3');
$rec[] = Array('NAVIGATEUR'=>'maxthon','jour 22'=>'2-2', 'jour 23'=>'2-3');
$TBS->MergeBlock('date',$date);
$TBS->MergeBlock('date_rec',$date);
$TBS->MergeBlock('rec',$rec);
$TBS->Show() ;
|
html code
<TABLE STYLE="border:1px solid #336699">
<TR class="type01">
<TD rowspan="2" align="center">Navigateur</TD>
<TD align="center" colspan="[var.nbStat]">Nombre</TD>
</TR>
<TR class="type01">
<TD align="center">[date.val;block=td;htmlconv=no]</TD>
</TR>
<TR BGCOLOR="#66CCFF">
<TD class="type03">[rec.NAVIGATEUR;block=tr]</TD>
<TD class="type02">[rec.[date_rec.val;block=td]]</TD>
</TR>
<TR>
<TD class="type03">[rec.NAVIGATEUR;block=tr]</TD>
<TD class="type02">[rec.[date_rec.val;block=td]]</TD>
</TR>
</TABLE>
|
result
<TABLE STYLE="border:1px solid #336699">
<TR class="type01">
<TD rowspan="2" align="center">Navigateur</TD>
<TD align="center" colspan="2">Nombre</TD>
</TR>
<TR class="type01">
<TD align="center">jour 22</TD><TD align="center">jour 23</TD>
</TR>
<TR BGCOLOR="#66CCFF">
<TD class="type03">IE</TD>
<TD class="type02">0-2</TD><TD class="type02">0-3</TD>
</TR><TR BGCOLOR="#66CCFF">
<TD class="type03">Opera</TD>
<TD class="type02">1-2</TD><TD class="type02">1-3</TD>
</TR><TR BGCOLOR="#66CCFF">
<TD class="type03">maxthon</TD>
<TD class="type02">2-2</TD><TD class="type02">2-3</TD>
</TR>
</TABLE>
|
|
By: Skrol29
Date: 2004-11-25
Time: 19:19
|
Re: Dynamical column and alternate colors
Hello CWL,
The behavior you've got is normal.
This is because the blocks [date_rec] of row #1 and row #2 should have two different names. When they have the same name, all that is bewteen the sections is deleted when merging.
They should be [date_rec1] and [date_rec2], and you should merge both of them.
If you are using TBS 2, don't forget that you can merge several blocks with the same data in one shot.
Example : $TBS->MergeBlock('date,daterec1,date_rec2',$date);
|
By: CWL
Date: 2004-11-25
Time: 19:39
|
Re: Dynamical column and alternate colors
Thank you very much for your efficiency, availability !
By the way, as you said, I merge at the same time date, date_rec1 and date_rec2 :
and I get this kind of error :
TinyButStrong Error (Object or Array value expected): Can't merge [rec.[date_rec2.val;block=td]] because the value before the key 'val;block=td]' (type: string) is not an object or an array. This message can be cancelled using parameter 'noerr'.
Then I go back to the old solution, merge one by one and that works fine !
P.S : il est petit mais costaud ( c'est pas une pub ça ? )
|
By: Skrol29
Date: 2004-11-26
Time: 04:04
|
Re: Dynamical column and alternate colors
Hum... I'm going to study that possible bug.
> P.S : il est petit mais costaud ( c'est pas une pub ça ? )
Yes, it was for "La Pie Qui Chante" :)
|
|
Posting in progress.
Please wait...
|