Jump to content

parse xml with php and display in columns


stitchlips

Recommended Posts

Can someone point me int right direction. I have an xml document that I am parsing using simplexml.

 

I can loop through my results and display them vertically in a table but I would like to display the data horizontally in columns.

 

I looked here http://www.phpfreaks.com/forums/index.php/topic,95426.0.html

 

I am not sure if that is what I need or not.

Thanks!

Here is my current code

<?php
$request_url = "exampl_url";
$xml = simplexml_load_file($request_url) or die("Something Wierd just happened, try refreshing your browser or come back in a minute or so.");
;?>
                        <?php
foreach($xml->SearchResult->ItemArray->Item as $Item){
$title = $Item->Title ;
$price = $Item->Price ;

?>

<table width="64%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td><?php echo $title; ?></font></a></td>
                            <td><span class="leftmenucopy"><font color="#FF0000"><?php echo $price; ?></font></span></td>
                          </tr>
                        </table>
<?php } ?>

 

 

It displays like this :

vert.jpg

 

I would like to have it display like this.

horiz.jpg

 

I am a newb.

Thanks

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.