Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Shannon Whitley http://www.voiceoftech.com/swhitley/

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Load PRX document and display elements

//Using a simple curl library (not shown) to get xml text
$curl = new CURL();
//$prx contains the url of a PRX document (e.g. http://www.prxbuilder.com/link.aspx?p=1)
$xml = $curl->get($prx);

//Load the XML file
$doc = new DOMDocument();
$doc->loadXML($xml);

//Retrieve specific PRX elements (subheadline, dateline, body)
$subheadline = $doc->getElementsByTagName('subheadline')->item(0)->nodeValue;
$dateline = $doc->getElementsByTagName('dateline')->item(0)->nodeValue;
$body = $doc->getElementsByTagName('body')->item(0)->nodeValue;

//Format and display - apply_filters is a WP function.
$content = '<p>'.$subheadline.'</p>';
$content .= '<p>'.$dateline.'</p>';
$content .= '<p>'.$body.'</p>';
$content = apply_filters('the_content_rss', $content);
$content = str_replace(']]>', ']]&gt;', $content);

echo $content;

Load PRX document and display elements

//Using a simple curl library (not shown) to get xml text
$curl = new CURL();
//$prx contains the url of a PRX document (e.g. http://www.prxbuilder.com/link.aspx?p=1)
$xml = $curl->get($prx);

//Load the XML file
$doc = new DOMDocument();
$doc->loadXML($xml);

//Retrieve specific PRX elements (subheadline, dateline, body)
$subheadline = $doc->getElementsByTagName('subheadline')->item(0)->nodeValue;
$dateline = $doc->getElementsByTagName('dateline')->item(0)->nodeValue;
$body = $doc->getElementsByTagName('body')->item(0)->nodeValue;

//Format and display - apply_filters is a WP function.
$content = '<p>'.$subheadline.'</p>';
$content .= '<p>'.$dateline.'</p>';
$content .= '<p>'.$body.'</p>';
$content = apply_filters('the_content_rss', $content);
$content = str_replace(']]>', ']]&gt;', $content);

echo $content;

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS