Jump to content
mrtc

XML to PHP product display code help please

Recommended Posts

Hello i need help to make a product display page from xml file ....

any one who can help me thanks 

 

i got an xml file products.xml 

 <PRODUCT>
      <PRODUCTS_NAME>Name of the product</PRODUCTS_NAME>
      <PRODUCTS_DESCRIPTION>Details of the products.</PRODUCTS_DESCRIPTION>
      <PRODUCTS_IMAGE>1111.jpg</PRODUCTS_IMAGE>
      <PRODUCTS_PRICE>44$</PRODUCTS_PRICE>
    </PRODUCT>

ok i used this code to get information of all the product name on the page 

<?php
$xml=simplexml_load_file("products.xml") or die("Error: Cannot create object");
foreach($xml->children() as $products) { 
    echo $products->PRODUCTS_NAME. "<br>"; 
} 
?>

its show all product name line by line 

ok so all i want to show full product one by one ... 

For example ( Product image | then product name | Then product price | Then product details )
 

Thanks for your help in advanced 

 

waiting for your answers 

Share this post


Link to post
Share on other sites

So output the others as you did with the product name, putting the <br> after the details output. The image will require an <img src="imagename" /> tag

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


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