php autogenerering af tabel
Jeg henter et rss feed og lægger indholdet i et array:$userlist = array();
$wherelist = array();
foreach($xml->channel->item as $Item){
$user = $Item->title;
$userlist[] = $user;
$where =$Item->description;
$wherelist[] = $where;
der efter skal jeg smide indholdet i en tabel, som har en del koloner, men jeg er lidt i tvivl om hvordan man auto udfølger dette, når den skal udfylde det således:
<table width="1800" border="1" cellpadding="4" cellspacing="4">
<tr>
<td>
status
</td>
<td><?php echo $userlist[0]; ?></td>
<td rowspan="2"><?php echo $wherelist[0]; ?></td>
<td width="75">SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[1]; ?></td>
<td rowspan="2"><?php echo $wherelist[1]; ?></td>
<td width="75">SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[2]; ?></td>
<td rowspan="2"><?php echo $wherelist[2]; ?></td>
</tr>
<tr>
<td> </td>
<td>billede 1</td>
<td width="75">SPACER</td>
<td> </td>
<td>billede2</td>
<td width="75">SPACER</td>
<td> </td>
<td>billede 3</td>
</tr>
<tr>
<td>
status
</td>
<td><?php echo $userlist[3]; ?></td>
<td rowspan="2"><?php echo $wherelist[3]; ?></td>
<td width="75">SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[4]; ?></td>
<td rowspan="2"><?php echo $wherelist[4]; ?></td>
<td width="75">SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[5]; ?></td>
<td rowspan="2"><?php echo $wherelist[5]; ?></td>
</tr>
<tr>
<td> </td>
<td>billede 4</td>
<td width="75">SPACER</td>
<td> </td>
<td>billede 5</td>
<td width="75">SPACER</td>
<td> </td>
<td>billede6</td>
</tr>
<tr>
<td>
status
</td>
<td><?php echo $userlist[6]; ?></td>
<td rowspan="2"><?php echo $wherelist[6]; ?></td>
<td width="75">SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[7]; ?></td>
<td rowspan="2"><?php echo $wherelist[7]; ?></td>
<td width="75">SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[8]; ?></td>
<td rowspan="2"><?php echo $wherelist[8]; ?></td>
</tr>
<tr>
<td> </td>
<td>billede7</td>
<td width="75">SPACER</td>
<td> </td>
<td>billede8</td>
<td width="75">SPACER</td>
<td> </td>
<td>billede9</td>
</tr>
<tr>
<td>
status
</td>
<td><?php echo $userlist[9]; ?></td>
<td rowspan="2"><?php echo $wherelist[9]; ?></td>
<td width="75">SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[10]; ?></td>
<td rowspan="2"><?php echo $wherelist[10]; ?></td>
<td width="75">SPACER</td>
<td>
statis
</td>
<td><?php echo $userlist[11]; ?></td>
<td rowspan="2"><?php echo $wherelist[11]; ?></td>
</tr>
<tr>
<td> </td>
<td>billede10</td>
<td width="75">SPACER</td>
<td> </td>
<td>billede11</td>
<td width="75">SPACER</td>
<td> </td>
<td>billede12</td>
</tr>
<tr>
<td>
status
</td>
<td><?php echo $userlist[12]; ?></td>
<td rowspan="2"><?php echo $wherelist[12]; ?></td>
<td width="75">SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[13]; ?></td>
<td rowspan="2"><?php echo $wherelist[13]; ?></td>
<td width="75">SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[14]; ?></td>
<td rowspan="2"><?php echo $wherelist[14]; ?></td>
</tr>
<tr>
<td> </td>
<td>billede13</td>
<td width="75">SPACER</td>
<td> </td>
<td>billede14</td>
<td width="75">SPACER</td>
<td> </td>
<td>billede15</td>
</tr>
<tr>
<td>
status
</td>
<td><?php echo $userlist[15]; ?></td>
<td rowspan="2"><?php echo $wherelist[15]; ?></td>
<td width="75">SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[16]; ?></td>
<td rowspan="2"><?php echo $wherelist[16]; ?></td>
<td width="75">SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[17]; ?></td>
<td rowspan="2"><?php echo $wherelist[17]; ?></td>
</tr>
<tr>
<td> </td>
<td>billede16</td>
<td>SPACER</td>
<td> </td>
<td>billede17</td>
<td>SPACER</td>
<td> </td>
<td>billede18</td>
</tr>
<tr>
<td>
status
</td>
<td><?php echo $userlist[18]; ?></td>
<td rowspan="2"><?php echo $wherelist[18]; ?></td>
<td>SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[19]; ?></td>
<td rowspan="2"><?php echo $wherelist[19]; ?></td>
<td>SPACER</td>
<td>
status
</td>
<td><?php echo $userlist[20]; ?></td>
<td rowspan="2"><?php echo $wherelist[20]; ?></td>
</tr>
<tr>
<td> </td>
<td>billede 19</td>
<td>SPACER</td>
<td> </td>
<td>billede 20</td>
<td>SPACER</td>
<td> </td>
<td>billede21</td>
</tr>
<tr>
<td>
STATUS
</td>
<td><?php echo $userlist[21]; ?></td>
<td rowspan="2"><?php echo $wherelist[21]; ?></td>
<td>SPACER</td>
<td>
STATUS
</td>
<td><?php echo $userlist[22]; ?></td>
<td rowspan="2"><?php echo $wherelist[22]; ?></td>
<td>SPACER</td>
<td>
STATUS
</td>
<td><?php echo $userlist[23]; ?></td>
<td rowspan="2"><?php echo $wherelist[23]; ?></td>
</tr>
<tr>
<td> </td>
<td>billede22</td>
<td>SPACER</td>
<td> </td>
<td>billede23</td>
<td>SPACER</td>
<td> </td>
<td>billede24</td>
</tr>
</table>
som i kan se, har jeg manuelt skrevet hvor den skal outputte fra array, men der må da være en måde at åfå den til at genere dette automatisk? således den laver hele tabellen selv, alt efter hvor meget der er i? og selv udfylder indholdet.
$userlist[] = $user;
$wherelist[] = $where;
følger hinanden så wherelist[0] indeholder det data der altid passer med userlist[0] osv osv..