| 1 |
|
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>Embperl Examples - Dynamic Tables</title> |
| 5 |
</head> |
| 6 |
<body background="../images/jazzbkgd.gif"> |
| 7 |
|
| 8 |
<h1>Embperl Examples - Dynamic Tables</h1> |
| 9 |
<hr><h3>This is a example of using the table tag to show the array @arr = ( 'A', 'B', 'C')</h3> |
| 10 |
|
| 11 |
[- @arr = ( 'A', 'B', 'C') ; -] |
| 12 |
<table border=1> |
| 13 |
<tr> |
| 14 |
<td> [+ $arr[$row] +] </td> |
| 15 |
</tr> |
| 16 |
</table> |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
<hr><h3>This is a example of using the table tag in embperl to show the environment</h3> |
| 21 |
|
| 22 |
[- @k = keys %ENV -] |
| 23 |
|
| 24 |
<h4>Using $row (one value per row)</h4> |
| 25 |
|
| 26 |
<table> |
| 27 |
<TR> |
| 28 |
<TH>Row</TH> |
| 29 |
<TH>Var</TH> |
| 30 |
<TH>Content</TH> |
| 31 |
</TR> |
| 32 |
<tr> |
| 33 |
<td>[+ $i=$row +] </td> |
| 34 |
<td>[+ $k[$row] +] </td> |
| 35 |
<td>[+ $ENV{$k[$i]} +] </td> |
| 36 |
</tr> |
| 37 |
</table> |
| 38 |
|
| 39 |
<hr> |
| 40 |
<h4>Using $col (one value per column, only one row)</h4> |
| 41 |
|
| 42 |
[-$maxcol=99-] |
| 43 |
<table> |
| 44 |
<tr> |
| 45 |
<td>[+ $i=$col +] </td> |
| 46 |
<td>[+ $k[$col] +] </td> |
| 47 |
<td>[+ $ENV{$k[$i]} +] </td> |
| 48 |
</tr> |
| 49 |
</table> |
| 50 |
|
| 51 |
|
| 52 |
<hr><h4>Using $cnt and $maxcol (three values per row)</h4> |
| 53 |
|
| 54 |
[-$maxcol=3-] |
| 55 |
<table> |
| 56 |
<tr> |
| 57 |
<td>[+ $i=$cnt +] </td> |
| 58 |
<td>[+ $k[$cnt] +] </td> |
| 59 |
<td>[+ $ENV{$k[$i]} +] </td> |
| 60 |
</tr> |
| 61 |
</table> |
| 62 |
|
| 63 |
<hr><h3>Display an two dimensional array with one, two and three columns !</h3> |
| 64 |
<h4>Please take a look at the source in your browser to see the difference</h4> |
| 65 |
|
| 66 |
[- |
| 67 |
$a[0][0] = '1/1' ; |
| 68 |
$a[1][0] = '2/1' ; |
| 69 |
$a[1][1] = '2/2' ; |
| 70 |
$a[2][0] = '3/1' ; |
| 71 |
$a[2][1] = '3/2' ; |
| 72 |
$a[2][2] = '3/3' ; |
| 73 |
|
| 74 |
$maxcol=99 ; |
| 75 |
-] |
| 76 |
$a[[0][[0] = '1/1' ;<BR> |
| 77 |
$a[[1][[0] = '2/1' ;<BR> |
| 78 |
$a[[1][[1] = '2/2' ;<BR> |
| 79 |
$a[[2][[0] = '3/1' ;<BR> |
| 80 |
$a[[2][[1] = '3/2' ;<BR> |
| 81 |
$a[[2][[2] = '3/3' ;<BR> |
| 82 |
|
| 83 |
<h4>$tabmode = default </h4> |
| 84 |
|
| 85 |
<table> |
| 86 |
<tr> |
| 87 |
<td>[+ $a[$row][$col] +] </td> |
| 88 |
</tr> |
| 89 |
</table> |
| 90 |
|
| 91 |
|
| 92 |
<hr><h4>$tabmode=3 + 48 ; $maxcol = 4; $maxrow = 4 </h4> |
| 93 |
[- $tabmode=3 + 48 ; $maxcol = 4; $maxrow = 4 -] |
| 94 |
|
| 95 |
<table> |
| 96 |
<tr> |
| 97 |
<td>[+ $a[$row][$col] +] </td> |
| 98 |
</tr> |
| 99 |
</table> |
| 100 |
|
| 101 |
<hr><h4> $tabmode=1 + 32 ; </h4> |
| 102 |
[- $tabmode=1 + 32 ; -] |
| 103 |
|
| 104 |
<table> |
| 105 |
<tr> |
| 106 |
<td>[+ $a[$row][$col] +] </td> |
| 107 |
</tr> |
| 108 |
</table> |
| 109 |
|
| 110 |
<p><hr> |
| 111 |
|
| 112 |
<small>HTML::Embperl (c) 1997-1998 G.Richter</small> |
| 113 |
|
| 114 |
|
| 115 |
</body> |
| 116 |
</html> |