Continuing on from their previous post on integrating PHP and the YouTube API, WaxJelly is back today with part two focusing on a cleaner, more powerful implementation of the script.
This is Part 2 of the YouTube API PHP Script. I've added a good bit of functionality, fixed a few bugs, and cleaned up the code from some unnecessary redundancies. However, I'm leaving Part 1 up for those of you who want the introduction. I'm mainly going to highlight the stuff that's new in this script and, as always, provide the code at the bottom of this post.
He shows the updates made, including:
- cleaning up of the $_GET vars
- the addition of constants
- new functions to help with setting up the page
- a function to loop through the results
- a large function to create the HTML in the output
- a function to add a "bookend" for each video pulled