Wat doet deze functie?
Heb nog niet lang een website overgenomen om die wat bij te werken, maar mijn kennis van php is zeeer miniem.
Daarom volgende vraag wat doet onderstaande code?
Graag in het vervolg bij code, [code] [/code] tags gebruiken.[/modedit]
Daarom volgende vraag wat doet onderstaande code?
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
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
<?php
function addSportaKalender($reeks, $officialName, $clubName){
$url = "http://lap.sporta.be/schrijftoegang/kalender_voan.php?s=47";
// build data for request
// $data_array = array('afdeling' => $reeks);
$data_array = array('afdeling' => $reeks, 'speeldag' => '0', 'club' => '0', 'ploeg' => '0');
// $data_array = array('afdeling' => '0', 'speeldag' => '0', 'club' => '0', 'ploeg' => '10455');
$data = http_build_query($data_array);
// load html
$html = str_get_html(do_post_request($url, $data));
$tables = $html -> find('table');
// get specific game table
$tableToUse = null;
foreach ($tables as $table) {
//echo $table;
$rows = $table -> find('tr');
if(count($rows) > 4){
// if(count($rows) > 6){
$tableToUse = $table;
break;
}
}
//echo '$tableToUse = '.$tableToUse;
if ($tableToUse) {
$rows = $tableToUse -> find("tr");
echo getTableHeaderKalender();
for($i = 5; $i < count($rows); $i++){
// for($i = 20; $i < count($rows); $i++){
//echo 'rij '.$i.'<br>';
$cells = $rows[$i] -> find('td');
// $cells = $rows[$i] -> find('td') or $cells = $rows[$i] -> find('th');
//if ($cells) {echo 'ok gevonden : '.$cells[2]->innertext;}
if ($cells and $cells[2]->innertext>'') {
if ($cells[5]->innertext==$officialName or $cells[6]->innertext==$officialName) {
if ($cells[5]->innertext==$officialName and $clubName>'') {$cells[5]->innertext=$clubName; }
else if ($cells[6]->innertext==$officialName and $clubName>'') {$cells[6]->innertext=$clubName; }
echo getTableRowKalender(false, $cells[0]->innertext, $cells[1]->innertext, $cells[2]->innertext, $cells[3]->innertext, $cells[4]->innertext, $cells[5]->innertext, $cells[6]->innertext, $cells[7]->innertext, $cells[8]->innertext, $cells[9]->innertext, $cells[10]->innertext);
}
} else {
$cells = $rows[$i] -> find('th');
$cells = $rows[$i] -> find('/tr');
}
}
echo getTableFooter();
}
}
?>
function addSportaKalender($reeks, $officialName, $clubName){
$url = "http://lap.sporta.be/schrijftoegang/kalender_voan.php?s=47";
// build data for request
// $data_array = array('afdeling' => $reeks);
$data_array = array('afdeling' => $reeks, 'speeldag' => '0', 'club' => '0', 'ploeg' => '0');
// $data_array = array('afdeling' => '0', 'speeldag' => '0', 'club' => '0', 'ploeg' => '10455');
$data = http_build_query($data_array);
// load html
$html = str_get_html(do_post_request($url, $data));
$tables = $html -> find('table');
// get specific game table
$tableToUse = null;
foreach ($tables as $table) {
//echo $table;
$rows = $table -> find('tr');
if(count($rows) > 4){
// if(count($rows) > 6){
$tableToUse = $table;
break;
}
}
//echo '$tableToUse = '.$tableToUse;
if ($tableToUse) {
$rows = $tableToUse -> find("tr");
echo getTableHeaderKalender();
for($i = 5; $i < count($rows); $i++){
// for($i = 20; $i < count($rows); $i++){
//echo 'rij '.$i.'<br>';
$cells = $rows[$i] -> find('td');
// $cells = $rows[$i] -> find('td') or $cells = $rows[$i] -> find('th');
//if ($cells) {echo 'ok gevonden : '.$cells[2]->innertext;}
if ($cells and $cells[2]->innertext>'') {
if ($cells[5]->innertext==$officialName or $cells[6]->innertext==$officialName) {
if ($cells[5]->innertext==$officialName and $clubName>'') {$cells[5]->innertext=$clubName; }
else if ($cells[6]->innertext==$officialName and $clubName>'') {$cells[6]->innertext=$clubName; }
echo getTableRowKalender(false, $cells[0]->innertext, $cells[1]->innertext, $cells[2]->innertext, $cells[3]->innertext, $cells[4]->innertext, $cells[5]->innertext, $cells[6]->innertext, $cells[7]->innertext, $cells[8]->innertext, $cells[9]->innertext, $cells[10]->innertext);
}
} else {
$cells = $rows[$i] -> find('th');
$cells = $rows[$i] -> find('/tr');
}
}
echo getTableFooter();
}
}
?>
Graag in het vervolg bij code, [code] [/code] tags gebruiken.[/modedit]
Gewijzigd op 06/10/2014 11:29:56 door Bas IJzelendoorn
Met alle respect... maar kun je dat niet beter aan de maker van de code vragen?
Ik begrijp je reactie maar die weigert elke medewerking.
>> Ik begrijp je reactie maar die weigert elke medewerking.
Dat zal dan wel z'n reden hebben neem ik aan. Wellicht omdat de code niet deugt?
Hoe dan ook... je vraagt nu aan ons om een code uit te leggen die gebruikmaakt van functies die niet getoond worden. Daarnaast is de code niet gedocumenteerd. Al met al wordt dat dus een lastig verhaal. Zeker als je zelf, zoals je aangeeft, zeer weinig kennis van PHP hebt.
Ik vrees dat je het grote werk toch zelf zal moeten doen. Met specifieke vragen willen we je uiteraard altijd helpen, maar ik denk niet dat heel veel mensen zin hebben om andermans niet-gedocumenteerde code te gaan ontleden.
Dat zal dan wel z'n reden hebben neem ik aan. Wellicht omdat de code niet deugt?
Hoe dan ook... je vraagt nu aan ons om een code uit te leggen die gebruikmaakt van functies die niet getoond worden. Daarnaast is de code niet gedocumenteerd. Al met al wordt dat dus een lastig verhaal. Zeker als je zelf, zoals je aangeeft, zeer weinig kennis van PHP hebt.
Ik vrees dat je het grote werk toch zelf zal moeten doen. Met specifieke vragen willen we je uiteraard altijd helpen, maar ik denk niet dat heel veel mensen zin hebben om andermans niet-gedocumenteerde code te gaan ontleden.
Zo te zien maakt het een tabel van clubs voor een sport.
Misschien Belgisch zaalvoetbal.
En vraag eens waarom die kerel niet mee wil werken.
Misschien Belgisch zaalvoetbal.
En vraag eens waarom die kerel niet mee wil werken.
Voor zover ik zie maakt die code een tabelletje met data.
Wat er achter getTableHeaderKalender() en getTableRowKalender() is mij niet duidelijk.
Evenals do_post_request() en str_get_html().
Wat er achter getTableHeaderKalender() en getTableRowKalender() is mij niet duidelijk.
Evenals do_post_request() en str_get_html().
Blijbkaar is het de bedoeling van deze functie dat de volledige kalender van een ploeg wordt opgeroepen maar dat werkt niet zoals het moet.
De kalender wordt opgehaald van lap.sporta.be/schrijftoegang/kalender_voan.php?s=47
function getTableHeaderKalender(){
return "<table id='kalender' cellspacing='0' style='display:table' border='0'>
<tr>
<th width='5%'>Nr</td>
<th width='33%'>Dag</th>
<th width='8%'>datum</th>
<th width='8%'>uur</th>
<th width='8%'>reeks</th>
<th width='8%'>thuisploeg</th>
<th width='8%'>bezoekers</th>
<th width='8%'>zaal</th>
<th width='8%'>terrein</th>
<th colspan='3' width='8%'>uitslag</th>
<th> </th>
</tr>";
}
function getTableHeader(){
return "<table id='klassement' cellspacing='0' style='display:table'>
<tr>
<th width='5%'>Nr</td>
<th width='33%'>Ploegnaam</th>
<th width='8%'>Gesp. wedstr. </th>
<th width='8%'>Gew. 3/0 of 3/1</th>
<th width='8%'>Gew. 3/2</th>
<th width='8%'>Verl. 3/2</th>
<th width='8%'>Verl. 3/0 of 3/1</th>
<th width='8%'>Gew. sets</th>
<th width='8%'>Verl. sets</th>
<th width='8%'>Punten-totaal</th>
</tr>";
}
heb ik ook teruggevonden.
Wie kan mij helpen om die functie van addSportaKalender mee te ontcijferen zodat die perfect gaat werken?
De kalender wordt opgehaald van lap.sporta.be/schrijftoegang/kalender_voan.php?s=47
function getTableHeaderKalender(){
return "<table id='kalender' cellspacing='0' style='display:table' border='0'>
<tr>
<th width='5%'>Nr</td>
<th width='33%'>Dag</th>
<th width='8%'>datum</th>
<th width='8%'>uur</th>
<th width='8%'>reeks</th>
<th width='8%'>thuisploeg</th>
<th width='8%'>bezoekers</th>
<th width='8%'>zaal</th>
<th width='8%'>terrein</th>
<th colspan='3' width='8%'>uitslag</th>
<th> </th>
</tr>";
}
function getTableHeader(){
return "<table id='klassement' cellspacing='0' style='display:table'>
<tr>
<th width='5%'>Nr</td>
<th width='33%'>Ploegnaam</th>
<th width='8%'>Gesp. wedstr. </th>
<th width='8%'>Gew. 3/0 of 3/1</th>
<th width='8%'>Gew. 3/2</th>
<th width='8%'>Verl. 3/2</th>
<th width='8%'>Verl. 3/0 of 3/1</th>
<th width='8%'>Gew. sets</th>
<th width='8%'>Verl. sets</th>
<th width='8%'>Punten-totaal</th>
</tr>";
}
heb ik ook teruggevonden.
Wie kan mij helpen om die functie van addSportaKalender mee te ontcijferen zodat die perfect gaat werken?




