de-tafels
Code (php)
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
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
<?php
// TAFELS BY JONATHAN MO & WESSEL BRUINSMA
// ....
// ---CONFIG------
$begintafel = 1;
$tottafel = 10;
$beginsom = 1;
$totsom = 10;
$rij = 5;
$breedte = false;
$hoogte = false;
//----------------
//----------------
$extra = '';
if ($rij == false)
{
$rij = 10;
}
if ($hoogte != false)
{
$extra .= chr(10).'height: '.$hoogte.';';
}
if ($breedte != false)
{
$extra .= chr(10).'width: '.$breedte.';';
}
if (($tottafel-($begintafel-1)) > ($rij-1))
{
$span = $rij;
}
else
{
$span = $tottafel-($begintafel-1);
}
echo '<style type="text/css">.tafels{padding: 2px;margin: 2px;border: 1px black solid;font-family: Arial;font-size: 10pt;background-color: #C0C0C0;'.$extra.'}.tafels tr td{padding: 5px;margin: 2px;border: 1px black solid;font-family: Arial;font-size: 10pt;background-color: white;}</style>';
$nu = $rij;
echo chr(10).'<table class="tafels"><tr><td colspan="'.$span.'"><b>De Tafels</b><br>Van de tafel '.$begintafel.' tot de tafel '.$tottafel.'.<br>Van de som '.$beginsom.' tot de som '.$totsom.'.';
for ($tafel = $begintafel; $tafel < ($tottafel + 1); $tafel++)
{
if ($nu == $rij)
{
$add = false;
echo '<tr>';
$nu--;
}
else
{
if ($nu == 1)
{
$nu = $rij;
$add = true;
}
else
{ $add = false;
$nu--;
}
}
echo '<td>';
for ($som = $beginsom; $som < ($totsom + 1); $som++)
{
if ($som != $beginsom)
{
echo '<br>'.chr(10);
}
$ant = $tafel * $som;
echo $tafel.' X '.$som.' = '.$ant;
}
echo '</td>'.chr(10);
if ($add)
{
echo '</tr>';
}
$last = $add;
}
if ($last == false)
{
echo '</tr>';
}
echo chr(10).'<tr><td colspan="'.$span.'"><i>Script By Wessel Bruinsma & Jonathan Mo</i></td></tr>';
echo '</table>';
//----------------
?>
// TAFELS BY JONATHAN MO & WESSEL BRUINSMA
// ....
// ---CONFIG------
$begintafel = 1;
$tottafel = 10;
$beginsom = 1;
$totsom = 10;
$rij = 5;
$breedte = false;
$hoogte = false;
//----------------
//----------------
$extra = '';
if ($rij == false)
{
$rij = 10;
}
if ($hoogte != false)
{
$extra .= chr(10).'height: '.$hoogte.';';
}
if ($breedte != false)
{
$extra .= chr(10).'width: '.$breedte.';';
}
if (($tottafel-($begintafel-1)) > ($rij-1))
{
$span = $rij;
}
else
{
$span = $tottafel-($begintafel-1);
}
echo '<style type="text/css">.tafels{padding: 2px;margin: 2px;border: 1px black solid;font-family: Arial;font-size: 10pt;background-color: #C0C0C0;'.$extra.'}.tafels tr td{padding: 5px;margin: 2px;border: 1px black solid;font-family: Arial;font-size: 10pt;background-color: white;}</style>';
$nu = $rij;
echo chr(10).'<table class="tafels"><tr><td colspan="'.$span.'"><b>De Tafels</b><br>Van de tafel '.$begintafel.' tot de tafel '.$tottafel.'.<br>Van de som '.$beginsom.' tot de som '.$totsom.'.';
for ($tafel = $begintafel; $tafel < ($tottafel + 1); $tafel++)
{
if ($nu == $rij)
{
$add = false;
echo '<tr>';
$nu--;
}
else
{
if ($nu == 1)
{
$nu = $rij;
$add = true;
}
else
{ $add = false;
$nu--;
}
}
echo '<td>';
for ($som = $beginsom; $som < ($totsom + 1); $som++)
{
if ($som != $beginsom)
{
echo '<br>'.chr(10);
}
$ant = $tafel * $som;
echo $tafel.' X '.$som.' = '.$ant;
}
echo '</td>'.chr(10);
if ($add)
{
echo '</tr>';
}
$last = $add;
}
if ($last == false)
{
echo '</tr>';
}
echo chr(10).'<tr><td colspan="'.$span.'"><i>Script By Wessel Bruinsma & Jonathan Mo</i></td></tr>';
echo '</table>';
//----------------
?>