Mercurial > hg > batmud > misc
comparison materials/info.php @ 329:0e4b2c94b75d misc
Sanitize material info HTML table generation.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 31 Dec 2015 03:04:24 +0200 |
parents | 98c798a843ed |
children | 27356bea526a |
comparison
equal
deleted
inserted
replaced
328:98c798a843ed | 329:0e4b2c94b75d |
---|---|
201 "<table class=\"materialInfo\" width=\"95%\">\n"; | 201 "<table class=\"materialInfo\" width=\"95%\">\n"; |
202 | 202 |
203 $n = 0; | 203 $n = 0; |
204 foreach ($matDataTable[$setShowMat] as $key => $val) | 204 foreach ($matDataTable[$setShowMat] as $key => $val) |
205 { | 205 { |
206 if ($n == 0) echo " <tr>"; | |
206 echo "<th>".chentities($matTransNames[$key + 1])."</th><td>"; | 207 echo "<th>".chentities($matTransNames[$key + 1])."</th><td>"; |
207 if (is_array($val)) | 208 if (is_array($val)) |
208 { | 209 { |
209 $tmp = []; | 210 $tmp = []; |
210 foreach ($val as $lode) | 211 foreach ($val as $lode) |
214 else | 215 else |
215 { | 216 { |
216 echo chentities($matTransTable[$key][$val]); | 217 echo chentities($matTransTable[$key][$val]); |
217 } | 218 } |
218 echo "</td>"; | 219 echo "</td>"; |
219 if ($n++ >= 2) { echo "</tr>\n<tr>"; $n = 0; } | 220 if (++$n >= 3) { echo "</tr>\n"; $n = 0; } |
220 } | 221 } |
221 echo "</tr>\n</table>\n"; | 222 if ($n != 0) echo "</tr>\n"; |
223 echo | |
224 "</table>\n\n"; | |
222 | 225 |
223 // | 226 // |
224 // Show alloy combinations table for this material | 227 // Show alloy combinations table for this material |
225 // | 228 // |
226 echo "<h3>Alloy combinations</h3>\n"; | 229 echo "<h3>Alloy combinations</h3>\n"; |