ldoozer Posted September 20, 2010 Share Posted September 20, 2010 Can anyone tell me how to parse one of the child elements in the xml below.I have accesses title,link and description using the following php, but I need to access the image width for example which is a child element.Please help!echo '<ul>';foreach ( $items as $item ) {$href = $item['link'];$title = $item['title'];$img = $item['description'];echo "<li><a href=$href>" . $img . "</a></li>";}echo "</ul>"; <item> <title>DSC00071</title> <link> <description><p><a href="http://www.flickr.com/people/53764782@N08/">SteveDupree</a> posted a photo:</p> <p><a href=" title="DSC00071"><img src="http://farm5.static.flickr.com/4149/4964530050_c51dc91b8f_m.jpg" width="240" height="180" alt="DSC00071" /></a></p></description> <pubDate>Mon, 06 Sep 2010 10:05:19 -0700</pubDate> <dc:date.Taken>2007-08-08T11:01:16-08:00</dc:date.Taken> <author flickr:profile="http://www.flickr.com/people/53764782@N08/">nobody@flickr.com (SteveDupree)</author> <guid isPermaLink="false">tag:flickr.com,2004:/photo/4964530050</guid> <media:content url="http://farm5.static.flickr.com/4149/4964530050_54c8625a59_o.jpg" type="image/jpeg" height="1224" width="1632"/> <media:title>DSC00071</media:title> <media:thumbnail url="http://farm5.static.flickr.com/4149/4964530050_c51dc91b8f_s.jpg" height="75" width="75" /> <media:credit role="photographer">SteveDupree</media:credit> </item> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.