"; ?> '; $collectionid = '18986'; $collectionlinkurl = 'http://www.fitzmuseum.cam.ac.uk/onlineresources/podcasts/'; $itemlinkbaseurl = 'http://www.fitzmuseum.cam.ac.uk/onlineresources/podcasts/article.html?'; $atomlink = ""; $itunesauthor = 'The Fitzwilliam Museum'; $itunesemail='fitzmuseum-enquiries@lists.cam.ac.uk'; /* get collection level RSS */ $collectionxml = getSmsRssSimpleXML($collectionid,'collection'); /* start the RSS output - Note: *should not* output anything to browser above this header() line*/ header('Content-type: text/xml'); echo $xmldecl.$rssdecl; /* RSS channel level output */ echo ""; echo "".getCollectionTitle($collectionxml).""; echo "".$itunesauthor.""; echo ""; echo "".getCollectionDescription($collectionxml).""; echo ""; echo "".$itunesauthor."".$itunesemail.""; echo "".$collectionlinkurl.""; echo $atomlink; echo "".getCollectionDescription($collectionxml).""; echo "".getCollectionTTL($collectionxml).""; echo "no"; echo "en-uk"; /*now echo out the RSS contents for each item*/ foreach($collectionxml->channel->item as $item) { //print_r($item); // need each media item's xml for duration, pubdate, media: block etc // see [note 1] bottom $mediaitemxml = getSmsRssSimpleXML(getCollectionItemRSSLink($item),''); //print_r($mediaitemxml); echo "\n\n\n"; echo "".$item->guid.""; echo "".getCollectionItemTitle($item).""; echo "".$itemlinkbaseurl.getCollectionItemID($item).""; echo "".getCollectionItemDescription($item).""; echo "".getMediaItemDuration($mediaitemxml).""; echo ""; echo "".getMediaItemPubDate($mediaitemxml).""; echo getITunesEnclosureXML($mediaitemxml); echo ""; } /* do closing RSS output */ echo "\n"; function getITunesEnclosureXML($mediaitemxml) { $filesize=0; $media_formats = getMediaItemFormatsArray($mediaitemxml); foreach ($mediaitemxml->channel->item as $entry) { // get nodes in media: namespace for media information $media = $entry->children('http://search.yahoo.com/mrss/'); foreach ($media->group->content as $content) { $attrs = $content->attributes(); // this is a bit rough - it basically trys to get the biggest m4v in the list // - on SMS this is generally the highest bitrate m4v available if($attrs['type']=="video/x-m4v" && $attrs['fileSize'] > $filesize) { $type=$attrs['type']; $url=$attrs['url']; $filesize=$attrs['fileSize']; } } } return ""; } // [note 1] should be careful of efficiency here - ie multiple rss calls for whole collection... // On the Fitz site this isn't too bad as the page will render once and then cache for hours // before it has to happen again - thereby caching providing efficiency (ie far fewer calls to SMS) ?>