note 92463 modified in domdocument.createtextnode by danbrown

From: Date: Sat, 25 Jul 2009 15:37:27 +0000
Subject: note 92463 modified in domdocument.createtextnode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-158720@lists.php.net to get a copy of this message
A quick note to anyone who is using character entities (e.g. &copy;) in this, and finding them automatically escaped. The correct thing to do here is to use the createEntityReference method (e.g. createEntityReference("copy");), and then appendChild this entity between text nodes. Example: <?php $copyright_text_1 = $this->document->createTextNode("Copyright "); $copyright_text_2 = $this->document->createTextNode(" Alex Kaye 2009"); $copyright_symbol = $this->document->createEntityReference("copy"); $copyright->appendChild($copyright_text_1); $copyright->appendChild($copyright_symbol); $copyright->appendChild($copyright_text_2); ?> --was-- A quick note to anyone who is using character entities (e.g. &copy;) in this, and finding them automatically escaped. The correct thing to do here is to use the createEntityReference method (e.g. createEntityReference("copy");), and then appendChild this entity between text nodes. Example: $copyright_text_1 = $this->document->createTextNode("Copyright "); $copyright_text_2 = $this->document->createTextNode(" Alex Kaye 2009"); $copyright_symbol = $this->document->createEntityReference("copy"); $copyright->appendChild($copyright_text_1); $copyright->appendChild($copyright_symbol); $copyright->appendChild($copyright_text_2); http://php.net/manual/en/domdocument.createtextnode.php

« previous php.notes (#158720) next »