JTable/toXML: Difference between revisions
From Joomla! Documentation
m removing red link to edit, no existant pages |
m preparing for archive only |
||
| Line 62: | Line 62: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=toXML | category=toXML | ||
category=JTable | category=JTable | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 01:11, 25 March 2017
Description
Export item list to xml
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
toXML($mapKeysToText=false)
| Parameter Name | Default Value | Description |
|---|---|---|
| $mapKeysToText | false | Map foreign keys to text values |
Defined in
libraries/joomla/database/table.php
Importing
jimport( 'joomla.database.table' );
Source Body
function toXML( $mapKeysToText=false )
{
$xml = '<record table="' . $this->_tbl . '"';
if ($mapKeysToText)
{
$xml .= ' mapkeystotext="true"';
}
$xml .= '>';
foreach (get_object_vars( $this ) as $k => $v)
{
if (is_array($v) or is_object($v) or $v === NULL)
{
continue;
}
if ($k[0] == '_')
{ // internal field
continue;
}
$xml .= '<' . $k . '><![CDATA[' . $v . ']]></' . $k . '>';
}
$xml .= '</record>';
return $xml;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples