All pastes #568961 Raw Edit

Miscellany

public php v1 · immutable
·published 2007-06-15 22:23 UTC
rendered paste body
function _ssplink_build_xml() {	$albums = taxonomy_get_tree(variable_get('ssplink_albumvid', null));	$xml = new DOMDocument('1.0', 'utf-8');	foreach ($albums as $album) {		$album_element = $xml->createElement('album');		$album_element->setAttribute('title', $album->name);		$album_element->setAttribute('description', $album->description);				$nodes = taxonomy_select_nodes(array($album->tid));		while ($node = db_fetch_object($nodes)) {			$node = node_load($node);			if ($node->status == 1) {				$image_element = $xml->createElement('image');				$image_element->setAttribute('src', $node->field_image[0]['filepath']);				$image_element->setAttribute('title', $node->title);				$image_element->setAttribute('caption', $node->field_caption[0]['value']);				$album_element->appendChild($image_element);			}		}				$xml->appendChild($album_element);	}	$headers = array('content-type: text/xml');		//add more later?	cache_set('ssplink_xml', 'cache', serialize($xml->saveXML()), CACHE_PERMANENT, serialize($headers));}