I am changing the subject and pulling data from my PODS tables. I also have a custom DBTOXML.php file that is called from index.php using an AJAX call. Since this is a special file that I introduced into the Wordpress theme, it does not seem to be able to find my Pod class, and therefore I cannot extract data from my PODS tables. Any idea how I can get this DBTOXML.php to work with PODS?
Here is the complete code for DBTOXML.php
<?php
$rwhdata = new Pod('rainwater');
$p = $rwhdata->fetchRecords();
$dom = new DOMDocument("1.0");
$node = $dom->createElement("Markers");
$parnode = $dom->appendChild($node);
while ($p->fetchRecord()) {
$node = $dom->createElement("marker");
$newnode = $parnode->appendChild($node);
$locString = $p->get_field('location');
list($latitude,$longitude)=split(',',$locString);
$newNode->setAttribute("latLocation",$latitude);
$newNode->setAttribute("longitude",$longitude);
}
echo $dom->saveXML();
?>
and this is a jquery call ...
$.ajax({
url:'<?php echo bloginfo('template_url').'/DBTOXML.php';?>',
type:'POST',
data:"",
success:function(results)
{
}
});
source
share