Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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