Jump to content

reijm1

Members
  • Posts

    6
  • Joined

  • Last visited

reijm1's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks, but I think that I have to apply a rule like for $i = 1 { <echo "<td style=\"backgroud-color:black; padding: 10px\">"; i++;}
  2. Hi all, I have a problem with a crosstable. I want to auto fill the empty cell with black background. The code now downloads the xml and fills each cell with the proper content, but leaves some empte with cells. As for now I have the following structure where [bLACK] at this points still is white without content <table> [bLACK][2][3][4] [1][bLACK][3][4] [1][2][bLACK][4] [1][2][3][bLACK] </table> $countries = array(); $dom = new DOMDocument(); $dom->load('http://www.antilopen.nl/competitie/kruistabel.asp?ci=314&xml=314&t=1'); echo "<table>"; $aantalrijen=$dom->getElementsByTagName('row')->length-1; for ($i = 0 ; $i <= $aantalrijen ; $i++) { ?> <tr class="<?php echo ($clrCounter++ % 2 == 0 ? 'odd' : 'even'); ?>"> <? foreach ($dom->getElementsByTagName('rij_'.$i) as $entry) { echo "<td style=\"padding: 10px\">"; echo $entry->nodeValue; echo "</td>"; } echo "</tr>"; } echo "</table>"; ?>
  3. Hi All, I`m pretty new with php but i`m trying to build a mobile page with xml extraction. I`m getting my xml data from an externa site trough simplexml and I want to sort this data on weeknumber, and within the weeknumber on team. The xml data that i`m requesting is <Datum_Tijd> and I want to transform it to a weeknumber.: xml code: <code> A2M 7688 15-5-2013 19:30:00 IJsselvogels A2 DVS '69 A1 7 8 </code> Until now I have this to witdraw my content: <code> <table cellpadding="1px" width="100%"> <tr align="left"> <th>Datum</th><th>Tijd</th><th>Thuis Ploeg</th><th>Uit Ploeg</th><th>Uitslag</th> </tr> <?php foreach ($xml->row AS $info ) { ?> <tr class="<?php echo ($clrCounter++ % 2 == 0 ? 'odd' : 'even'); ?>"> <td><?php $date = date_create($info -> Datum_Tijd); echo date_format($date, 'd-m');?></td> <td><?php $date = date_create($info -> Datum_Tijd); echo date_format($date, 'H:i');?></td> <td <?php if (strpos($info -> Thuisploeg,'IJsselvogels') !== false) {echo 'style="color: #FF0000;"';} ?> ><?php echo $info -> Thuisploeg ?></td> <td <?php if (strpos($info -> Uitploeg,'IJsselvogels') !== false) {echo 'style="color: #FF0000;"';} ?> ><?php echo $info -> Uitploeg ?></td> <td><?php echo $info -> Scorethuis . " - " . $info -> Scoreuit ?></td> </tr> <? }?> </code> But I want: Week 14: result team1 result team2 etc. week 13: result team1 result team2 etc. can you help?
  4. Hallo allemaal, Ik heb via een xml data uit een kruistabel gehaald, en deze netjes in een tabel geplaatst. Tot zover gaat het allemaal goed. Maar ik wil graag de niet gebruikte cellen in de kruistabel zwart vullen, zodat je direct ziet dat deze niet gebruikt wordt: Een voorbeeld van de xml is: <root> <row> <Klasse>A1F</Klasse> <rij_0/> <rij_1>Fortuna A2</rij_1> <rij_2>IJsselvogels A1</rij_2> <rij_3>KCR A2</rij_3> <rij_4>KOAG A1</rij_4> <rij_5>KVS A2</rij_5> <rij_6>ODO A1</rij_6> <rij_7>Vitesse A1</rij_7> <rij_8>Weidevogels A1</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>Fortuna / MHIR A2</rij_0> <rij_1/> <rij_2>8 - 20</rij_2> <rij_3>6 - 8</rij_3> <rij_4>5 - 17</rij_4> <rij_5/> <rij_6>10 - 17</rij_6> <rij_7>9 - 9</rij_7> <rij_8>14 - 16</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>IJsselvogels A1</rij_0> <rij_1/> <rij_2/> <rij_3>14 - 14</rij_3> <rij_4>5 - 8</rij_4> <rij_5>11 - 8</rij_5> <rij_6/> <rij_7>9 - 6</rij_7> <rij_8>13 - 13</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>KCR A2</rij_0> <rij_1>16 - 11</rij_1> <rij_2>7 - 17</rij_2> <rij_3/> <rij_4>7 - 13</rij_4> <rij_5>13 - 5</rij_5> <rij_6>7 - 12</rij_6> <rij_7/> <rij_8>11 - 10</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>KOAG A1</rij_0> <rij_1/> <rij_2>7 - 6</rij_2> <rij_3>13 - 7</rij_3> <rij_4/> <rij_5>17 - 3</rij_5> <rij_6>18 - 8</rij_6> <rij_7>14 - 7</rij_7> <rij_8>15 - 6</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>KVS A2</rij_0> <rij_1>10 - 9</rij_1> <rij_2>7 - 17</rij_2> <rij_3>11 - 7</rij_3> <rij_4>4 - 16</rij_4> <rij_5/> <rij_6>6 - 18</rij_6> <rij_7>8 - 17</rij_7> <rij_8/> </row> <row> <Klasse>A1F</Klasse> <rij_0>ODO A1</rij_0> <rij_1>10 - 5</rij_1> <rij_2>10 - 4</rij_2> <rij_3/> <rij_4>9 - 10</rij_4> <rij_5>19 - 11</rij_5> <rij_6/> <rij_7/> <rij_8>13 - 7</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>Vitesse A1</rij_0> <rij_1>17 - 6</rij_1> <rij_2/> <rij_3>14 - 5</rij_3> <rij_4>9 - 11</rij_4> <rij_5>16 - 10</rij_5> <rij_6>8 - 9</rij_6> <rij_7/> <rij_8>9 - 7</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>Weidevogels A1</rij_0> <rij_1>14 - 9</rij_1> <rij_2>12 - 15</rij_2> <rij_3>12 - 8</rij_3> <rij_4/> <rij_5>7 - 7</rij_5> <rij_6>13 - 14</rij_6> <rij_7>9 - 11</rij_7> <rij_8/> </row> </root> Zijn er mensen die er ervaring mee hebben? Vraag 2: Ik heb nu handmatig de rijen 0 - 8 als rij ingevoerd, is het mogelijk om de rijen automatisch op basis van de xml te vullen, en daarnaast ook de velden in de <th> velden om die automatisch te vullen? Kruistabel <table cellpadding="1px" width="100%"> <tr align="left"> <th><?php echo $kruistabel -> rij_0 ?></th><th><?php echo $kruistabel -> rij_1 ?></th><th><?php echo $kruistabel -> rij_2 ?></th><th><?php echo $kruistabel -> rij_3 ?></th><th><?php echo $kruistabel -> rij_4 ?></th><th><?php echo $kruistabel -> rij_5 ?></th> </tr> <? foreach ( $xmlkruis->row AS $kruistabel ) { ?> <tr class="<?php echo ($clrCounter++ % 2 == 0 ? 'odd' : 'even'); ?>"> <td><?php echo $kruistabel -> rij_0 ?></td> <td><?php echo $kruistabel -> rij_1 ?></td> <td><?php echo $kruistabel -> rij_2 ?></td> <td><?php echo $kruistabel -> rij_3 ?></td> <td><?php echo $kruistabel -> rij_4 ?></td> <td><?php echo $kruistabel -> rij_5 ?></td> <td><?php echo $kruistabel -> rij_6 ?></td> <td><?php echo $kruistabel -> rij_7 ?></td> <td><?php echo $kruistabel -> rij_8 ?></td> </tr> <?}?> </table>
  5. Hoi Allemaal, Ik ben nog redelijk nieuw met het programmeren van PHP en ben bezig met een mobiele pagina. Ik haal via xml gegevens van een externe site en wil deze weergeven op de pagina. De pagina laat gegevens uit de xml zien maar wil deze nu sorteren op weeknummer. De XML gegevens die ik opvraag is, waarbij ik <Datum_Tijd> gebruik om de weeknummer te bepalen: <root> <row> <Klassenaam>A2M</Klassenaam> <Wedstrijdnummer>7688</Wedstrijdnummer> 15-5-2013 19:30:00 <Thuisploeg>IJsselvogels A2</Thuisploeg> <Uitploeg>DVS '69 A1</Uitploeg> <Scorethuis>7</Scorethuis> <Scoreuit>8</Scoreuit> <Opmerking/> </row> <row> Tot dusver heb ik dit, dit laat keurig de uitslagen zien: natuurlijk na het laden van de xml met simplexml: <table cellpadding="1px" width="100%"> <tr align="left"> <th>Datum</th><th>Tijd</th><th>Thuis Ploeg</th><th>Uit Ploeg</th><th>Uitslag</th> </tr> <?php foreach ($xml->row AS $info ) { ?> <tr class="<?php echo ($clrCounter++ % 2 == 0 ? 'odd' : 'even'); ?>"> <td><?php $date = date_create($info -> Datum_Tijd); echo date_format($date, 'd-m');?></td> <td><?php $date = date_create($info -> Datum_Tijd); echo date_format($date, 'H:i');?></td> <td <?php if (strpos($info -> Thuisploeg,'IJsselvogels') !== false) {echo 'style="color: #FF0000;"';} ?> ><?php echo $info -> Thuisploeg ?></td> <td <?php if (strpos($info -> Uitploeg,'IJsselvogels') !== false) {echo 'style="color: #FF0000;"';} ?> ><?php echo $info -> Uitploeg ?></td> <td><?php echo $info -> Scorethuis . " - " . $info -> Scoreuit ?></td> </tr> <? }?> Maar ik wil dus (waarbij de weeknummer de afgelopen 2 weken zijn): Week 14: uitslag team1 uitslag team2 etc. week 13: uitslag team1 uitslag team2 etc. Kunnen jullie helpen?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.