mercredi 27 juillet 2016

Need to this table with 100 rows and asign a valor to the code PHP

I need to solve this simple thing: Got this code:

<?php
$xml=simplexml_load_file("d2ladder.xml") or die("Error: Cannot create object");
?>    
<table width="100%" border="1" cellspacing="0" cellpadding="2" align="center" style="text-align:center">
  <tbody>
    <tr class="<?php if ($xml->ladder[12]->char[0]->status == "alive") { echo "alive"; } else { echo "dead"; } ?>">
      <td width="10%">1.</td>
      <td width="50%" style="text-align:left"><?php echo $xml->ladder[12]->char[0]->prefix; ?> <?php echo $xml->ladder[12]->char[0]->name; ?></td>
      <td width="10%"><?php echo $xml->ladder[12]->char[0]->class; ?></td>
      <td width="10%"><?php echo $xml->ladder[12]->char[0]->level; ?></td>
      <td width="20%"><?php echo $xml->ladder[12]->char[0]->experience; ?></td>
    </tr>
        <tr class="<?php if ($xml->ladder[12]->char[1]->status == "alive") { echo "alive"; } else { echo "dead"; } ?>">
      <td width="10%">2.</td>
      <td width="50%" style="text-align:left"><?php echo $xml->ladder[12]->char[1]->prefix; ?> <?php echo $xml->ladder[12]->char[1]->name; ?></td>
      <td width="10%"><?php echo $xml->ladder[12]->char[1]->class; ?></td>
      <td width="10%"><?php echo $xml->ladder[12]->char[1]->level; ?></td>
      <td width="20%"><?php echo $xml->ladder[12]->char[1]->experience; ?></td>
    </tr>

  </tbody>
</table>

Need to create rows on this table till char[99] Maybe I need to use while? Because sometimes it wont get to 99 on the sitemap

Aucun commentaire:

Enregistrer un commentaire