[ Index ]
 

Code source de Typo3 4.1.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/t3lib/ -> class.t3lib_xml.php (sommaire)

Contains class for creating XML output from records $Id: class.t3lib_xml.php 593 2005-04-01 14:37:15Z typo3 $ Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj

Author: Kasper Skaarhoj <kasperYYYY@typo3.com>
Poids: 324 lignes (10 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

t3lib_xml:: (17 méthodes):
  t3lib_xml()
  setRecFields()
  getResult()
  WAPHeader()
  renderHeader()
  renderFooter()
  newLevel()
  output()
  indent()
  renderRecords()
  addRecord()
  getRowInXML()
  utf8()
  substNewline()
  fieldWrap()
  WAPback()
  addLine()


Classe: t3lib_xml  - X-Ref

XML class, Used to create XML output from input rows.
Doesn't contain a lot of advanced features - pretty straight forward, practical stuff
You are encouraged to use this class in your own applications.

t3lib_xml($topLevelName)   X-Ref
Constructor, setting topLevelName to the input var

param: string        Top Level Name
return: void

setRecFields($table,$list)   X-Ref
When outputting a input record in XML only fields listed in $this->XML_recFields for the current table will be rendered.

param: string        Table name
param: string        Commalist of fields names from the table, $table, which is supposed to be rendered in the XML output. If a field is not in this list, it is not rendered.
return: void

getResult()   X-Ref
Returns the result of the XML rendering, basically this is imploding the internal ->lines array with linebreaks.

return: string

WAPHeader()   X-Ref
Initialize WML (WAP) document with <?xml + <!DOCTYPE header tags and setting ->topLevelName as the first level.

return: void

renderHeader()   X-Ref
Initialize "anonymous" XML document with <?xml + <!DOCTYPE header tags and setting ->topLevelName as the first level.
Encoding is set to UTF-8!

return: void

renderFooter()   X-Ref
Sets the footer (of ->topLevelName)

return: void

newLevel($name,$beginEndFlag=0,$params=array()   X-Ref
Indents/Outdents a new level named, $name

param: string        The name of the new element for this level
param: boolean        If false, then this function call will *end* the level, otherwise create it.
param: array        Array of attributes in key/value pairs which will be added to the element (tag), $name
return: void

output($content)   X-Ref
Function that will return the content from string $content. If the internal ->XMLdebug flag is set the content returned will be formatted in <pre>-tags

param: string        The XML content to output
return: string        Output

indent($b)   X-Ref
Increments/Decrements Indentation counter, ->XMLIndent
Sets and returns ->Icode variable which is a line prefix consisting of a number of tab-chars corresponding to the indent-levels of the current posision (->XMLindent)

param: boolean        If true the XMLIndent var is increased, otherwise decreased
return: string        ->Icode - the prefix string with TAB-chars.

renderRecords($table,$res)   X-Ref
Takes a SQL result for $table and traverses it, adding rows

param: string        Tablename
param: pointer        SQL resource pointer, should be reset
return: void

addRecord($table,$row)   X-Ref
Adds record, $row, from table, $table, to the internal array of XML-lines

param: string        Table name
param: array        The row to add to XML structure from the table name
return: void

getRowInXML($table,$row)   X-Ref
Internal function for adding the actual content of the $row from $table to the internal structure.
Notice that only fields from $table that are listed in $this->XML_recFields[$table] (set by setRecFields()) will be rendered (and in the order found in that array!)
Content from the row will be htmlspecialchar()'ed, UTF-8 encoded and have chr(10) (newlines) exchanged for '<newline/>' tags. The element name for a value equals the fieldname from the record.

param: string        Table name
param: array        Row from table to add.
return: void

utf8($content)   X-Ref
UTF-8 encodes the input content (from ISO-8859-1!)

param: string        String content to UTF-8 encode
return: string        Encoded content.

substNewline($string)   X-Ref
Substitutes chr(10) characters with a '<newline/>' tag.

param: string        Input value
return: string        Processed input value

fieldWrap($field,$value)   X-Ref
Wraps the value in tags with element name, $field.

param: string        Fieldname from a record - will be the element name
param: string        Value from the field - will be wrapped in the elements.
return: string        The wrapped string.

WAPback()   X-Ref
Creates the BACK button for WAP documents

return: void

addLine($str)   X-Ref
Add a line to the internal XML structure (automatically prefixed with ->Icode.

param: string        Line to add to the $this->lines array
return: void



Généré le : Sun Nov 25 17:13:16 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics