Hello David,
I'm trying to do something but I'm still unsuccessful after trying many things !
I've a simple function like
function myRecordHandler($record)
{
if ($_GET['ref']<>$record["CBIEN"]) return;
print "".$record["BIENDESC/LTITRE"]."";
// Some functions come here, but no problem for this side
return TRUE;
MagicParser_parse("".$feedprincipal."","myRecordHandler","xml|BACKSLASH/BIEN/");
So for this function there is no problem. It search an item in a large feed and returns informations.
My problem is (simple I think !!) that I need to return a message if there is no item relative to the search in the feed. Something like "else if" but I don't find the way to use this kind of function
Hi,
The easiest way is to use a global variable which you set to TRUE within myRecordHandler so that the rest of your script knows that you have got results. Then if it is FALSE after the parse, you can display your message. Try something like this:
$results = FALSE;
function myRecordHandler($record)
{
global $results;
if ($_GET['ref']<>$record["CBIEN"]) return;
print "".$record["BIENDESC/LTITRE"]."";
// Some functions come here, but no problem for this side
$results = TRUE;
return TRUE;
}
MagicParser_parse("".$feedprincipal."","myRecordHandler","xml|BACKSLASH/BIEN/");
if (!$results)
{
print "Sorry, there were no results";
}
Hope this helps!
Cheers,
David.