| 1 |
<html> |
| 2 |
<head> |
| 3 |
<title>HTML table tag in Embperl</title> |
| 4 |
</head> |
| 5 |
|
| 6 |
<body> |
| 7 |
|
| 8 |
|
| 9 |
<p> $tabmode = default <p> |
| 10 |
|
| 11 |
<hr><p>Display an two dimensional array with one, two and three columns !<BR> |
| 12 |
Please take a look at the source in your browser to see the difference<BR> |
| 13 |
|
| 14 |
[- |
| 15 |
undef @a ; |
| 16 |
undef @b ; |
| 17 |
|
| 18 |
$a[0][0] = 'a1/1' ; |
| 19 |
$a[1][0] = 'a2/1' ; |
| 20 |
$a[1][1] = 'a2/2' ; |
| 21 |
$a[2][0] = 'a3/1' ; |
| 22 |
$a[2][1] = 'a3/2' ; |
| 23 |
$a[2][2] = 'a3/3' ; |
| 24 |
|
| 25 |
$b[0][0] = 'b1/1' ; |
| 26 |
$b[1][0] = 'b2/1' ; |
| 27 |
$b[1][1] = 'b2/2' ; |
| 28 |
$b[2][0] = 'b3/1' ; |
| 29 |
$b[2][1] = 'b3/2' ; |
| 30 |
$b[2][2] = 'b3/3' ; |
| 31 |
|
| 32 |
$maxcol=99 ; |
| 33 |
-] |
| 34 |
$a[0][[0] = '1/1' ;<BR> |
| 35 |
$a[1][[0] = '2/1' ;<BR> |
| 36 |
$a[1][[1] = '2/2' ;<BR> |
| 37 |
$a[2][[0] = '3/1' ;<BR> |
| 38 |
$a[2][[1] = '3/2' ;<BR> |
| 39 |
$a[2][[2] = '3/3' ;<BR> |
| 40 |
|
| 41 |
<P>$tabmode = default <P> |
| 42 |
|
| 43 |
<table> |
| 44 |
<tr> |
| 45 |
<td>[+ $a[$row][0] +]</td> |
| 46 |
</tr> |
| 47 |
</table> |
| 48 |
<table> |
| 49 |
<tr> |
| 50 |
<td>[+ $a[2][$col] +]</td> |
| 51 |
</tr> |
| 52 |
</table> |
| 53 |
|
| 54 |
|
| 55 |
<table> |
| 56 |
<tr> |
| 57 |
<td>before[+ $a[$row][0] +]</td> |
| 58 |
</tr> |
| 59 |
</table> |
| 60 |
<table> |
| 61 |
<tr> |
| 62 |
<td>before[+ $a[2][$col] +]</td> |
| 63 |
</tr> |
| 64 |
</table> |
| 65 |
|
| 66 |
<table> |
| 67 |
<tr> |
| 68 |
<td>[+ $a[$row][0] +]after</td> |
| 69 |
</tr> |
| 70 |
</table> |
| 71 |
<table> |
| 72 |
<tr> |
| 73 |
<td>[+ $a[2][$col] +]after</td> |
| 74 |
</tr> |
| 75 |
</table> |
| 76 |
<table> |
| 77 |
<tr> |
| 78 |
<td>before[+ $a[$row][0] +]after</td> |
| 79 |
</tr> |
| 80 |
</table> |
| 81 |
<table> |
| 82 |
<tr> |
| 83 |
<td>before[+ $a[2][$col] +]after</td> |
| 84 |
</tr> |
| 85 |
</table> |
| 86 |
|
| 87 |
<table> |
| 88 |
<tr> |
| 89 |
<td>[+ $c[$row] +]</td> |
| 90 |
</tr> |
| 91 |
</table> |
| 92 |
<table> |
| 93 |
<tr> |
| 94 |
<td>[+ $c[$col] +]</td> |
| 95 |
</tr> |
| 96 |
</table> |
| 97 |
|
| 98 |
|
| 99 |
<table border="1" width="100%"> |
| 100 |
<tr> |
| 101 |
<td>[+ $a[$row][$col] +] </td> |
| 102 |
</tr> |
| 103 |
</table> |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
<table border="4"> |
| 108 |
<tr> |
| 109 |
<td> |
| 110 |
<table> |
| 111 |
<tr> |
| 112 |
<td>[+ $b[$row][$col] +] </td> |
| 113 |
</tr> |
| 114 |
</table> |
| 115 |
|
| 116 |
[+ $a[$row][$col] +] </td> |
| 117 |
</tr> |
| 118 |
</table> |
| 119 |
|
| 120 |
<table border="5" width="100%"> |
| 121 |
<tr> |
| 122 |
<td>[+ $b[2][$col] +]</td> |
| 123 |
</tr> |
| 124 |
<tr> |
| 125 |
<td>[+ $a[2][$col] +] </td> |
| 126 |
</tr> |
| 127 |
</table> |
| 128 |
|
| 129 |
<table border="6" width="100%"> |
| 130 |
<tr> |
| 131 |
<td>[+ $a[$row+1][0] +]</td> |
| 132 |
</tr> |
| 133 |
<tr> |
| 134 |
<td>[+ $a[$row][0] +] </td> |
| 135 |
</tr> |
| 136 |
</table> |
| 137 |
|
| 138 |
<table border="6.1" width="100%"> |
| 139 |
<tr> |
| 140 |
<td>[+ $a[$rows+1][0] +]</td> |
| 141 |
</tr> |
| 142 |
<tr> |
| 143 |
<td>[+ $a[$rows][0] +] </td> |
| 144 |
</tr> |
| 145 |
<tr> |
| 146 |
<td>[+ $rows +] </td> |
| 147 |
</tr> |
| 148 |
</table> |
| 149 |
|
| 150 |
<table border="7"> |
| 151 |
<tr> |
| 152 |
<TD BGCOLOR="[+ ($row & 1)?(($col&1)?'#7CFC00':'#A4A4B4'):(($col&1)?'#FFFF00':'#F4A460') +]">[+ $a[$row][$col] +] </td> |
| 153 |
</tr> |
| 154 |
</table> |
| 155 |
|
| 156 |
|
| 157 |
[- $a[0][1] = 'a1/2' ; -] |
| 158 |
|
| 159 |
<table border="8"> |
| 160 |
<tr> |
| 161 |
<TD BGCOLOR="#F4A460">[+ $a[$row*2][$col*2] +] </td> |
| 162 |
<TD BGCOLOR="#FFFF00">[+ $a[$row*2][$col*2+1] +] </td> |
| 163 |
</tr> |
| 164 |
<tr> |
| 165 |
<TD BGCOLOR="#A4A4B4">[+ $a[$row*2+1][$col*2] +] </td> |
| 166 |
<TD BGCOLOR="#7CFC00">[+ $a[$row*2+1][$col*2+1] +] </td> |
| 167 |
</tr> |
| 168 |
</table> |
| 169 |
|
| 170 |
[- $a[0][1] = undef ; -] |
| 171 |
|
| 172 |
|
| 173 |
[- |
| 174 |
|
| 175 |
undef @regs ; |
| 176 |
undef @kats ; |
| 177 |
|
| 178 |
$regs[0]{Id} = 'Pfalz' ; |
| 179 |
$regs[1]{Id} = 'Rheinhessen' ; |
| 180 |
|
| 181 |
$kats[0]{Id} = 'Kultur' ; |
| 182 |
$kats[1]{Id} = 'Sport' ; |
| 183 |
|
| 184 |
-] |
| 185 |
<table border="9" width="100%"> |
| 186 |
<tr> |
| 187 |
<td><table border="10"> |
| 188 |
<tr> |
| 189 |
<td valign="top"> |
| 190 |
<a href="inhalt.htm?Region=[+$regs[$row]{Id}+]">[+$regs[$row]{Id}+]</a></td> |
| 191 |
</tr> |
| 192 |
</table> |
| 193 |
</td> |
| 194 |
<td><table border="11"> |
| 195 |
<tr> |
| 196 |
<td valign="top"><p align="left"> |
| 197 |
<a href="inhalt.htm?Kategorie=[+$kats[$row]{Id}+]">[+$kats[$row]{Id}+]</a></p> |
| 198 |
</td> |
| 199 |
</tr> |
| 200 |
</table> |
| 201 |
</td> |
| 202 |
</tr> |
| 203 |
</table> |
| 204 |
|
| 205 |
[- |
| 206 |
$kats[2]{Id} = 'Veranstaltungen' ; |
| 207 |
$kats[3]{Id} = '' ; |
| 208 |
|
| 209 |
-] |
| 210 |
|
| 211 |
<table border="12" width="100%"> |
| 212 |
<tr> |
| 213 |
<td><table border="13"> |
| 214 |
<tr> |
| 215 |
<td valign="top"> |
| 216 |
[- print LOG "row= $row regs=$regs[0]{Id}\n" ; 1 ; -] |
| 217 |
[- print LOG "1row= $row regs=$regs[0]{Id}\n" ; $cmp = $regs[0]->{Id} ; print LOG "2row= $row regs=$regs[0]{Id}\n" ; 1 ; -] |
| 218 |
[- while (($k, $v) = each (%{$regs[0]})) { print LOG "$v=$k;\n" ; } -] |
| 219 |
[$if ($cmp || '') ne '' $] |
| 220 |
<a href="inhalt.htm?Region=[+ do { print LOG "row= $row regs=$regs[0]{Id}\n" ; $regs[$row]{Id} } +]">[+$regs[$row]{Id}+]</a></td> |
| 221 |
[$endif$] |
| 222 |
</tr> |
| 223 |
</table> |
| 224 |
</td> |
| 225 |
<td><table border="14"> |
| 226 |
<tr> |
| 227 |
<td valign="top"><p align="left"> |
| 228 |
[- print LOG "row= $row regs=$kats[0]{Id}\n" ; 1 ; -] |
| 229 |
[- $cmp = $kats[$row]{Id} -] |
| 230 |
[$if ($cmp || '') ne '' $] |
| 231 |
<a href="inhalt.htm?Kategorie=[+$kats[$row]{Id}+]">[+$kats[$row]{Id}+]</a></p> |
| 232 |
[$endif$] |
| 233 |
</td> |
| 234 |
</tr> |
| 235 |
</table> |
| 236 |
</td> |
| 237 |
</tr> |
| 238 |
</table> |
| 239 |
|
| 240 |
[- |
| 241 |
# build tight loop table with array data, multidimensional 5x6 |
| 242 |
@array = sort ("Hello", "World", "2000", "Hello", "World", "2000"); |
| 243 |
@multi = (\@array, \@array, \@array, \@array, \@array); |
| 244 |
-] |
| 245 |
<table> |
| 246 |
<tr bgcolor="[+ $row % 2?'gray':'white' +]"> |
| 247 |
<td align="center"><font size="+1">[+ $multi[$row][$col] +]</font></td> |
| 248 |
</tr> |
| 249 |
</table> |
| 250 |
|
| 251 |
|
| 252 |
<table border="14"><tr><td>[+ $a[$row][0] +]</td></tr></table> |
| 253 |
<table border="15"><tr><td>[+ $a[2][$col] +]</td></tr></table> |
| 254 |
<table border="16"><tr><td>[+ $a[$row][$col] +]</td></tr> </table> |
| 255 |
|
| 256 |
<table border="17"> |
| 257 |
<tr> |
| 258 |
<td>[+ $a[$icon_height=$row][0] +]</td> |
| 259 |
<td> |
| 260 |
[- $icon_width = 5 ; -] |
| 261 |
|
| 262 |
<IMG |
| 263 |
[$ if (($server_type eq "iii")) $] |
| 264 |
SRC="/i/www.[+ $server_type +]/[+ $badge || "iiilogo_narrow_if" +].gif" WIDTH="[+ $icon_width +]" HEIGHT="[+ $icon_height +]" BORDER="0" |
| 265 |
[$ else $] |
| 266 |
SRC="/icons/[+ $badge || "iiilogo_narrow_else" +].gif" WIDTH="[+ $icon_width +]" HEIGHT="[+ $icon_height +]" BORDER="0" |
| 267 |
[$ endif $] |
| 268 |
[$ if ($badge eq "iit") $] |
| 269 |
ALT="iit logo" |
| 270 |
[$ else $] |
| 271 |
ALT="iii logo" |
| 272 |
[$ endif $]> |
| 273 |
</td> |
| 274 |
</tr> |
| 275 |
</table> |
| 276 |
|
| 277 |
<table> |
| 278 |
<tr> |
| 279 |
<td>[+ $a[$row][0] +]</td> |
| 280 |
</tr> |
| 281 |
</table> |
| 282 |
<table> |
| 283 |
<tr> |
| 284 |
<td>[+ $a[2][$col] +]</td> |
| 285 |
</tr> |
| 286 |
</table> |
| 287 |
|
| 288 |
|
| 289 |
</body> |
| 290 |
</html> |