PHP Classes

File: fwphp/01mater/fw_popel/exp_B2_xml.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/01mater/fw_popel/exp_B2_xml.php  >  Download  
File: fwphp/01mater/fw_popel/exp_B2_xml.php
Role: Example script
Content type: text/plain
Description: Example script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change:
Date: 3 months ago
Size: 995 bytes
 

Contents

Class file image Download
<?php
// J:\awww\apl\dev1\z30GB\04knjige\02popel\ch7books_in_out\exp_B2_xml.php
/**
* Page lists all the books we have as an XML data structure
*/
                  //include('common.inc.php');
// Set the content type to be XML
header('Content-Type: application/xml');
// Get the books list
$books = Model::getDetailsWithMasters();


// Echo XML declaration and open root element
echo '<?xml version="1.0"?>', "\n";

echo
"<books>\n";
   
// ITERATE OVER EVERY BOOK AND DISPLAY IT
   
while($b = $books->fetch())
    {
   
?>
<book id="<?=$b->id?>">
        <isbn><?=$b->isbn?></isbn>
        <title><?=htmlspecialchars($b->title)?></title>
        <publisher><?=htmlspecialchars($b->publisher)?></publisher>
        <summary><?=htmlspecialchars($b->summary)?></summary>
        <author>
        <id><?=$b->author?></id>
        <lastName><?=$b->lastName?></lastName>
        <firstName><?=$b->firstName?></firstName>
        </author>
        </book>
    <?php
   
}
echo
'</books>';
?>

For more information send a message to info at phpclasses dot org.