Video Metadata feed

Posted on
$node_item){ if(array_key_exists($node_item['nid'], $global_data)){ $meta_data[$key]['global_tags'] = $global_data[$node_item['nid']]; } if(array_key_exists($node_item['nid'],$sneaky_data)){ $meta_data[$key]['sneaky_tags'] = $sneaky_data[$node_item['nid']]; } } //echo '
';print_r($meta_data);exit;
  $meta_xml = new DOMDocument();
  $root = $meta_xml->appendChild($meta_xml->createElement("Items"));
  foreach($meta_data as $meta){
    $item = $root->appendChild($meta_xml->createElement("Item"));
    $item->appendChild($meta_xml->createElement("nid", $meta['nid']));
    $item->appendChild($meta_xml->createElement("title", $meta['title']));
    $item->appendChild($meta_xml->createElement("body", $meta['body']));
    $item->appendChild($meta_xml->createElement("air_date", $meta['field_air_date_value']));
    $item->appendChild($meta_xml->createElement("episode_order", $meta['field_episode_video_order_value']));
    $global_tag_xml = $item->appendChild($meta_xml->createElement("global_tags"));
    $sneaky_tag_xml = $item->appendChild($meta_xml->createElement("sneaky_tags"));
    $item->appendChild($meta_xml->createElement("video_pid", $meta['field_video_id_value']));
    $item->appendChild($meta_xml->createElement("created_date", $meta['created']));
    $item->appendChild($meta_xml->createElement("changed_date", $meta['changed']));
    if($meta['global_tags'] && count($meta['global_tags'])>0){
      foreach($meta['global_tags'] as $global_tag){
        $global_tag_xml->appendChild($meta_xml->createElement("global_tag",$global_tag));
      }
    }
    if($meta['sneaky_tags'] && count($meta['sneaky_tags'])>0){
      foreach($meta['sneaky_tags'] as $sneaky_tag){
        $sneaky_tag_xml->appendChild($meta_xml->createElement("sneaky_tag",$sneaky_tag));
      }
    }
  }
header('Content-Type: text/plain');
$meta_xml->formatOutput = true;
echo $meta_xml->saveXML(); die;

?>