note 59470 added to function.dom-domnode-appendchild
| From: | manuel at mononeurona dot org | Date: | Wed, 07 Dec 2005 20:58:54 +0000 |
| Subject: | note 59470 added to function.dom-domnode-appendchild | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99704@lists.php.net to get a copy of this message | ||
A function (inside a class) to generate XML node (with spanish support) from database table using
PEAR database layer:
public function setGalerias() {
$R = $this->db->query("SELECT id, title FROM gallerys");
$ar = $this->doc->createElement("gallerys");
$ar = $this->root->appendChild($ar);
while ($R->fetchInto($row)) {
$temp = $this->doc->createElement('gals');
$temp = $ar->appendChild($temp);
$value = $this->doc->createTextNode('gals' . "\n");
$value = $ar->appendChild($value);
$child = $this->doc->createElement( 'id' );
$temp->appendChild( $child )->appendChild( $this->doc->createTextNode( $row[0] ) );
$text = mb_convert_encoding(trim($row[1]), "iso-8859-1", "UTF-8");
$child = $this->doc->createElement( 'titulo' );
$temp->appendChild( $child )->appendChild( $this->doc->createTextNode( $text .
"\n") );
}
}
----
Manual Page -- http://www.php.net/manual/en/function.dom-domnode-appendchild.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59470
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59470&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59470&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59470&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59470&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59470&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59470&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59470&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59470&report=yes
Search -- http://master.php.net/manage/user-notes.php