Login   Register  
PHP Classes
elePHPant
Icontem

File: doc.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Pierpaolo  >  Resultset2xml  >  doc.txt  >  Download  
File: doc.txt
Role: Documentation
Content type: text/plain
Description: A very little documentation
Class: Resultset2xml
Generate XML documents from MySQL query results
Author: By
Last change:
Date: 7 years ago
Size: 1,823 bytes
 

Contents

Class file image Download
Hi, this is a little documentation of this class.

To use the object you must:
1. Instanciate it
2. Configure it
3. Get the results.

Details:
1. To instanciate use #Resultset2xml($name, $subName, $resultset, $indent=true, $header="", $encoding="iso-8859-1")
- $name: the name of the root in XML
- $subName: the name of each record element in XML
- $resultset: the resultset you want to export
- $indent (default is true): specify if you want each line is indented or not (not is when you use xml into Macromedia Flash(c) and the text is not displayed "as html").
- $header (default empty): specify text you want to insert between the declaration of the file and the root tag (for example an other fixed tag)
- $encoding (default is iso-8859-1): no comment

2. To configure your result use
#add_field($name, $type="", $replaceName="", $replaceContent="")
- $name: the name of the field in the db
- $type: the type of the field: you should use as value
-- $instanceName->FIELS_INSERT to export the field as it is
-- $instanceName->FIELS_TEXT to export the field after process it (modify the method #_text2flash)
-- $instanceName->FIELS_DATE to export the fiel after process it as date  (modify the method #_date2str)
- $replaceName (dafault is empty): to choose the tag name used in XML for this field
- $replaceContent (dafault is empty): tho replace the text with $replaceContent (e.g. if $replaceContent="prev-{0}-next" and the value in the db is "xxxxx", then the result in xml is "prev-xxxxx-next".

Other fields will be ignored.

3. Get the results
Using $instanceName->getXml() you can get the xml into your string.

Note:
If you not use mysql as database, please change into the line:
- while($element = mysql_fetch_array($this->resultset)){ 
with
- "yourprefered"_fetch_array(