File: table.htm

package info (click to toggle)
libembperl-perl 2.5.0-17
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 7,632 kB
  • sloc: ansic: 21,387; perl: 14,497; javascript: 4,280; cpp: 467; xml: 49; makefile: 35; sh: 24
file content (116 lines) | stat: -rw-r--r-- 2,151 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

<html>
<head>
<title>Embperl Examples - Dynamic Tables</title>
</head>
<body background="../images/jazzbkgd.gif">

<h1>Embperl Examples - Dynamic Tables</h1>
<hr><h3>This is a example of using the table tag to show the array @arr = ( 'A', 'B', 'C')</h3>

[- @arr = ( 'A', 'B', 'C') ; -]
<table border=1>
   <tr>
	<td> [+ $arr[$row] +] </td>
   </tr>
</table>



<hr><h3>This is a example of using the table tag in embperl to show the environment</h3>

[- @k = keys %ENV -]

<h4>Using $row (one value per row)</h4>

<table>
  <TR>
    <TH>Row</TH>
    <TH>Var</TH>
    <TH>Content</TH>
  </TR>
    <tr>
        <td>[+ $i=$row +] </td>
        <td>[+ $k[$row] +] </td>
        <td>[+ $ENV{$k[$i]} +] </td>
    </tr> 
</table>

<hr>
<h4>Using $col (one value per column, only one row)</h4>

[-$maxcol=99-]
<table>
    <tr>
        <td>[+ $i=$col +] </td>
        <td>[+ $k[$col] +] </td>
        <td>[+ $ENV{$k[$i]} +] </td>
    </tr> 
</table>


<hr><h4>Using $cnt and $maxcol (three values per row)</h4>

[-$maxcol=3-]
<table>
    <tr>
        <td>[+ $i=$cnt +] </td>
        <td>[+ $k[$cnt] +] </td>
        <td>[+ $ENV{$k[$i]} +] </td>
    </tr> 
</table>

<hr><h3>Display an two dimensional array with one, two and three columns !</h3>
<h4>Please take a look at the source in your browser to see the difference</h4>

[-
   $a[0][0] = '1/1' ;
   $a[1][0] = '2/1' ;
   $a[1][1] = '2/2' ;
   $a[2][0] = '3/1' ;
   $a[2][1] = '3/2' ;
   $a[2][2] = '3/3' ;

   $maxcol=99 ;
-]
   $a[[0][[0] = '1/1' ;<BR>
   $a[[1][[0] = '2/1' ;<BR>
   $a[[1][[1] = '2/2' ;<BR>
   $a[[2][[0] = '3/1' ;<BR>
   $a[[2][[1] = '3/2' ;<BR>
   $a[[2][[2] = '3/3' ;<BR>

<h4>$tabmode = default </h4>

<table>
    <tr>
        <td>[+ $a[$row][$col] +] </td>
    </tr> 
</table>


<hr><h4>$tabmode=3 + 48 ; $maxcol = 4; $maxrow = 4 </h4>
[- $tabmode=3 + 48 ; $maxcol = 4; $maxrow = 4 -]

<table>
    <tr>
        <td>[+ $a[$row][$col] +] </td>
    </tr> 
</table>

<hr><h4> $tabmode=1 + 32 ; </h4>
[- $tabmode=1 + 32 ; -]

<table>
    <tr>
        <td>[+ $a[$row][$col] +] </td>
    </tr> 
</table>

<p><hr>

<small>HTML::Embperl (c) 1997-1998 G.Richter</small>


</body>
</html>