Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP File Handling with PHP Parsing Specific Formats Writing XML

Jonathan Healy
Jonathan Healy
21,601 Points

MP3 Link Fails to Work

After creating the write_xml.php page and testing the add Podcast on podcasts.php, I discovered that the play button doesn't work.

I believe this is due to the fact that the url is appended via a <link> tag in write_xml.php. After examining the xml files, the .mp3 urls that are functioning are instead embedded in <enclosure> tags.

I have yet to determine a fix!

Try adding this into the if statement in the write_xml.php page...

$enclosure = $item->addChild('enclosure', filter_input(INPUT_POST, 'link', FILTER_SANITIZE_URL));
$enclosure->addAttribute('url', $enclosure);

It creates the enclosure tag with url attribute and assigns the submitted link to the attribute.

1 Answer

Jonathan Healy
Jonathan Healy
21,601 Points

@davidha That worked great! Thanks