You are here:  » Error


Error

Submitted by crusnac on Wed, 2010-03-17 19:25 in

Here is my parse script:

<?php
print MagicParser_getErrorMessage();
require("MagicParser.php");
function myRecordHandler($entry){
print "<div class=\"sm2-inline-block\">";
print "<div class=\"copyright\">";
     print "<span class=\"author\">".$entry["AUTHOR"]."</span> <br />";
     print $entry["COPYRIGHT"];
print "</div>";
     print "<h3>".$entry["TITLE"]."</h3>";
     print "<div class=\"ui360\"><a href=\"/public/mp3/".$entry["ALTO"]."\"></a>Alto";
print "<a href=\"/download.rdl?f=".$entry["ALTO"]."\" class=\"360-exclude\"><img src=\"/public/images/download.png\"></a></div>";
     print "<div class=\"ui360\"><a href=\"/public/mp3/".$entry["TENOR"]."\"></a>Tenor";
print "<a href=\"/download.rdl?f=".$entry["TENOR"]."\" class=\"360-exclude\"><img src=\"/public/images/download.png\"></a></div>";
print "</div>";
}
MagicParser_parse("MagicParserTest.xml","myRecordHandler","xml|SONGDB/ENTRY/");
?>

My XML

Works fine on my local system, but not on my Godaddy shared hosting.

Error I get:

Fatal error: Call to undefined function MagicParser_getErrorMessage() in /home/content/52/5826852/html/public/test.php on line 2

Submitted by support on Wed, 2010-03-17 20:08

Hi,

Your script contains your call to MagicParser_getErrorMessage() before the line to require() MagicParser.php; which is why you are getting the error.

However you will also need to add the line to print the error after the call to MagicParser_parse() in order for it to return any useful information. for example:

<?php
require("MagicParser.php");
function 
myRecordHandler($entry){
print 
"<div class=\"sm2-inline-block\">";
print 
"<div class=\"copyright\">";
     print 
"<span class=\"author\">".$entry["AUTHOR"]."</span> <br />";
     print 
$entry["COPYRIGHT"];
print 
"</div>";
     print 
"<h3>".$entry["TITLE"]."</h3>";
     print 
"<div class=\"ui360\"><a href=\"/public/mp3/".$entry["ALTO"]."\"></a>Alto";
print 
"<a href=\"/download.rdl?f=".$entry["ALTO"]."\" class=\"360-exclude\"><img src=\"/public/images/download.png\"></a></div>";
     print 
"<div class=\"ui360\"><a href=\"/public/mp3/".$entry["TENOR"]."\"></a>Tenor";
print 
"<a href=\"/download.rdl?f=".$entry["TENOR"]."\" class=\"360-exclude\"><img src=\"/public/images/download.png\"></a></div>";
print 
"</div>";
}
MagicParser_parse("MagicParserTest.xml","myRecordHandler","xml|SONGDB/ENTRY/");
print 
MagicParser_getErrorMessage();
?>

Make sure that MagicParserTest.xml is on your server in the same directory as your test script, and it should then work fine..

Hope this helps,
All the best,
David.