This function returns a database table contents as a formatted text variable. By default, it generates a tabulated text file.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$table | The table to export. | |
$fieldList | '*' | The list of fields to select from the table. |
$whereClause | '' | Optional WHERE clauses put in the end of the query, if none, supply blank string. |
$groupBy | '' | Optional GROUP BY field(s), if none, supply blank string. |
$orderBy | '' | Optional ORDER BY field(s), if none, supply blank string. |
$limit | '' | Optional LIMIT value ([begin,]max), if none, supply blank string. |
$sepField | 9 | The ASCII separator character for each field. |
$sepRow | 10 | The ASCII separator character for each row. |
$directOut | 0 | Output the generated file directly as a text file. |
$directOutCharset | 'iso-8859-1' | The charset for the output file. |
This function returns a database table contents as an XML object.
SPECIAL NOTE: This function can be called without the API class instantiated.
Parameter: | Default value: | Description: |
|---|---|---|
$table | The table to export. | |
$fieldList | '*' | The list of fields to select from the table. |
$whereClause | '' | Optional WHERE clauses put in the end of the query, if none, supply blank string. |
$groupBy | '' | Optional GROUP BY field(s), if none, supply blank string. |
$orderBy | '' | Optional ORDER BY field(s), if none, supply blank string. |
$limit | '' | Optional LIMIT value ([begin,]max), if none, supply blank string. |
$uppercase | 0 | Use uppercase for XML tags. |
$xmlDeclaration | 1 | Insert XML declaration. |
$xmlVersion | '1.0' | The XML version. |
$xmlEncoding | 'iso-8859-1' | The XML encoding. |
$directOut | 1 | Output the generated file directly as an XML file. |
$ns | false | The XML namespace. |
$nsPrefix | 'ns' | The prefix used in the XML to link elements to the namespace. |
Here's the kind of output you will get:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: | <?xml version="1.0" encoding="iso-8859-1"?> <!-- - Typo3 XML Export - - Generation Time: Thu, 25 Nov 2004 23:00:00 +0100 - - Host: localhost - Database: typo3_db - Table: fe_users --> <typo3_db> <fe_users> <uid>1</uid> <username>admin</username> </fe_users> <fe_users> <uid>2</uid> <username>macmade</username> </fe_users> <typo3_db> |
This example has been generated with the following command:
1: 2: | // Export fe_users $this->api->table2xml('fe_users','uid,username'); |