load('http://the217.com/feeds/amuzu_events.rss'); $arrFeed = array(); //then we'll parse it into something we can actually use foreach ($doc->getElementsByTagName('item') as $node) { //grab the category first, since we need it to sort things by $cat = $node->getElementsByTagName('category')->item(0)->nodeValue; //get the rest of the data $itemRSS = array ( 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'category' => $cat, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue, 'venueName' => $node->getElementsByTagName('venueName')->item(0)->nodeValue, 'venueAddress' => $node->getElementsByTagName('venueAddress')->item(0)->nodeValue, 'venueName' => $node->getElementsByTagName('venueName')->item(0)->nodeValue, 'venueCity' => $node->getElementsByTagName('venueCity')->item(0)->nodeValue, ); //the enclosure has to be treated special, because not all items have one, and because //we need an attribute value rather than the nodeValue $enclosure = $node->getElementsByTagName('enclosure')->item(0); if($enclosure) { $itemRSS['enclosure'] = $enclosure->getAttribute('url'); } //slap it all together $arrFeed[$cat][] = $itemRSS; } //output and format everything echo '

'.date('l, F j, Y', mktime()).'

'; foreach ($arrFeed as $category => $events) { echo '

'.$category.'

'; foreach($events as $event) { echo '
'; if(isset($event['enclosure'])) { echo ''; } echo ''.$event['title'].''; echo '
'; echo ''; echo $event['venueName'].' - '.date('g:i a', strtotime($event['date'])); echo ''; echo '
'; //trim down the description to a certain number of words $desc = explode(" ", strip_tags($event['desc'])); $desc = array_slice($desc, 0, 25); $desc = implode(" ", $desc); echo $desc.'...'; echo '
'; } } echo '
'; echo ''; echo 'Brought to you by our sister Web site the217.com
'; echo 'Visit the217.com to see events for the days ahead and submit your own.'; echo '
'; ?>