Videos


numPosts = 5; $config->targetFeed = "http://gdata.youtube.com/feeds/base/users/DrDavidBanda/uploads?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile"; $config->showTitle = true; $config->showLink = false; $config->showDate = true; $config->showContent = true; $config->showImage = true; /* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */ $newDoc = new DOMDocument(); $newDoc->load($config->targetFeed); $config->tags = $newDoc->getElementsByTagName("*"); foreach($config->tags as $thisTag) { parseRSS($newDoc,$config); break; } function parseRSS($doc,$settings) { $counter = 0; $fullList = $doc->getElementsByTagName("item"); foreach($fullList as $thisItem) { if ($counter >= $settings->numPosts) { break; } $values = $thisItem->getElementsByTagName("*"); $title = ""; $link = ""; $date = ""; $content = ""; $image = ""; foreach($values as $node) { if($node->nodeName == "title" && $settings->showTitle == true) {$title = $node->nodeValue;} if($node->nodeName == "link" && $settings->showLink == true) {$link = $node->nodeValue;} if($node->nodeName == "pubDate" && $settings->showDate == true) {$date = $node->nodeValue;} if($node->nodeName == "description" && $settings->showContent == true) {$content = $node->nodeValue;} if($node->nodeName == "url" && $settings->showImage == true) {$image = $node->nodeValue;} } outputHTML($title,$link,$date,$content,$image); $counter++; } } function parseAtom($doc,$settings) { $counter = 0; $fullList = $doc->getElementsByTagName("entry"); foreach($fullList as $thisItem) { if ($counter >= $settings->numPosts) { break; } $values = $thisItem->getElementsByTagName("*"); $title = ""; $link = ""; $date = ""; $content = ""; foreach($values as $node) { if($node->nodeName == "title" && $settings->showTitle == true) {$title = $node->nodeValue;} if($node->nodeName == "link" && $settings->showLink == true && $node->attributes->getNamedItem("rel")->nodeValue == "alternate") {$link = $node->attributes->getNamedItem("href")->nodeValue;} if($node->nodeName == "published" && $settings->showDate == true) {$date = $node->nodeValue;} if($node->nodeName == "content" && $settings->showContent == true) {$content = $node->nodeValue;} } outputHTML($title,$link,$date,$content,$image); $counter++; } } function outputHTML($t,$l,$d,$c,$i) { if ($t != "") { echo "

"; if ($l != "") { echo ""; } echo $t; if ($l != "") { echo ""; } echo "

"; } if ($d != "") { echo "

" . date('F jS Y',strtotime($d)) . "

"; } if ($c != "") { echo "

" . $c . "

"; } } ?>