Show one or two records
Submitted by aslater on Wed, 2009-06-10 13:39.Magic Parser
Hello is it possible to just show the first couple of records only from an xml file?
Support forum loginActive forum topics©2006-2012 IAAI Software |
Show one or two recordsSubmitted by aslater on Wed, 2009-06-10 13:39.Magic Parser
Hello is it possible to just show the first couple of records only from an xml file? |
Hi,
Sure - you can stop the parser by returning TRUE from your myRecordHandler function; so all you need to do is keep a global counter, increment the counter for each record and then return TRUE if has reached the number you wish to display. For example:
<?phpfunction myRecordHandler($record)
{
global $counter;
// display $record as normal
$counter++;
if ($counter == 2) return TRUE; // stop after 2 records
}
?>
Hope this helps!
Cheers,
David.