You are here:  » Isolate first record


Isolate first record

Submitted by aslater on Mon, 2009-05-18 18:42 in

Hello is it possible to isolate the first record in an XML file using magic parser, so I can add additional css and html to format this record only?

Thanks

Submitted by support on Mon, 2009-05-18 20:11

Hi,

Sure; you could do this using global variables; for example:

  $first = TRUE;
  function myRecordHandler($record)
  {
    global $first;
    if ($first)
    {
      // add additional css and html here
      $first = FALSE;
    }
  }

However, unless you want to refer to fields within $record in order to generate that HTML (such as generating a dynamic title element for example) it is the same as just creating that output anywhere in your script before you call MagicParser_parse()...

Hope this helps!
Cheers,
David.