Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Start XML file, create parent node
- $xml = new XMLWriter();
- $xml->openMemory(); // create document in memory (AKA storing into a var)
- $xml->setIndent(true); // autoindent output
- $xml->setIndentString(' '); // set kind of indentation
- $xml->startDocument('1.0','UTF-8'); // start xml declaration with encoding utf-8
- $xml->startElement("markers");
- foreach( $dbMarkers as $m )
- {
- $xml->startElement("marker");
- $xml->writeAttribute("photo", $m['img'] );
- $xml->writeAttribute("name", $m['name'] );
- $xml->writeAttribute("lng", $m['lng']);
- $xml->writeAttribute("lat", $m['lat']);
- $xml->endElement();
- }
- $xml->endElement();
- echo $xml->outputMemory(false);
Add Comment
Please, Sign In to add comment