Hi,
I use now alwys MagicParser_parse($filename,"feedHandler",$format); to parse the feeds. Now i need to make 6 functions that i only need 1 time. Now is there a way to use the script whitout function ?
Best regards WOuter
Hello David,
I know that i can use it that way. But i think its a bit strange to make a function for a peace script that i only use 1 time. So thats why i ask if can use the script whitout a function.
Hi,
I see what you are saying; and if your XML is such that it only contains 1 record then the function will only be called once; but the script is designed to handle XML with many records, where your handler function is called many times.
You can do anything inside a function that you could do without; don't forget to use "global" if you want to access variables from elsewhere in your script; for example:
function myRecordHandler($record)
{
global $id;
$id = $record["ID"];
}
Cheers,
David.
Hello Wouter,
You can use as many different handler functions as you need, just make sure they all have different names.... for example:
MagicParser_parse($filename,"feedHandler1",$format1);
MagicParser_parse($filename,"feedHandler2",$format2);
MagicParser_parse($filename,"feedHandler3",$format3);
etc. etc.
Cheers,
David.