69er
|
| Posted: 02/08/2002, 4:23 PM |
|
it seems only ASP users need to alternate row colors in a grid - how do us non-template using PHPers acheive this effect? please specify w/ sample code.
|
|
|
 |
Nicole
|
| Posted: 02/09/2002, 2:47 AM |
|
PHP version:
See Bugs form / Open event :
$myswitch = true;
$prev_row="";
The above code is a mere initialization ,myswitch is a boolean variable
used to determine which one of 2 colors to show. prev_row accumulates
html of the grid.
if ($myswitch)
$bgcolor="#999999";
else
$bgcolor="#DDDDDD";
$myswitch = !$myswitch;
$row = "<tr bgcolor=". $bgcolor . "><td>" . $fldbug_id . "<td>" . $fldbug_name . "</td>" . "</td></tr>";
$prev_row .= $row;
$tpl->set_var ("DListBugs", $prev_row);
Second way:
Here are the steps done to add alternate color functionality to Bugs grid.
1) Open Form Properties/Style and check "Custom Style" checkbox
2) Select DataTD item , add the line below
bgcolor={bgcolor}
3) code in Form/Open event : ColorSwitch = true
4) code in Form/Before Show event :
if ($ColorSwitch)
$bgcolor = "#EEEECC";
else
$bgcolor = "#F3F2E6";
$ColorSwitch = !$ColorSwitch;
$tpl->set_var ("bgcolor", ToHtml($bgcolor));
|
|
|
 |
Robert Hellemans
|
| Posted: 02/09/2002, 4:37 PM |
|
put in your CC created php file at:
// step 1 - find this....
//-------------------------------
// Create field variables based on database fields
//-------------------------------
// step 2 - okay now insert these lines:
$setbgcolor2 = "#eeeeee"; // set background color for the listing not even rowcolor 2
$setbgcolor1 = "#dddddd"; // and ofcourse the color for all even rows , color 1
$bgcolor = $setbgcolor1;
$iCounter % 2 ? 0: $bgcolor = $setbgcolor2;
// step 3 - find this...
//-------------------------------
// Replace Template fields with database values
//-------------------------------
// step 4 - add this line:
$tpl->set_var("bgcolor", ($bgcolor));
// STEP 5 - change in HTML file your data with <TR> or <TD> whatever you need
i.e:
<tr>
<td ><a href="{Field1_URLLink}?emp_id={PrmField1_emp_id}&{TransitParams}"><font >{Field1}</font></a> </td>
<td bgcolor={bgcolor}><font >{name} </font></td>
<td bgcolor={bgcolor}><font >{firstname} </font></td>
<td bgcolor={bgcolor}><font >{dep_id} </font></td>
<td bgcolor={bgcolor}><font >{campus} </font></td>
</tr>
---- Good luck -----
for any problems you can reach me atdutchmoviez@hotmail.com
|
|
|
 |
|