wispas Posted April 20, 2008 Share Posted April 20, 2008 After hours I finally managed to get this Simple XML working now. I now want to enchance and was wondering if anyone knows how to add image links to the XML and display it with PHP. XML File <?xml version="1.0" encoding="utf-8"?> <library> <shelf id="fiction"> <book> <title>Of Mice and Men</title> <author>John Steinbeck</author> <desc>Whats this</desc> </book> <book> <title>Harry Potter and the Philosopher's Stone</title> <author>J.K. Rowling</author> <desc>Whats that</desc> </book> </shelf> </library> PHP File <?php $library = simplexml_load_file('library.xml'); foreach ($library->shelf as $shelf) { printf("Shelf %s\n", $shelf['id']); foreach ($shelf->book as $book) { printf("Title: %s\n", $book->title); printf("Author: %s\n", $book->author); printf("Description: %s\n", $book->desc); } } ?> I want to add a image field to the XML for each of the books and display it with PHP. Link to comment https://forums.phpfreaks.com/topic/102010-adding-images-to-xml-and-displaying-with-php/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.