|
Posted by Ken Tozier on 09/20/05 03:05
On Sep 19, 2005, at 7:19 PM, Stephen Leaf wrote:
> On Monday 19 September 2005 06:04 pm, Ken Tozier wrote:
> Not a bad Idea.
> You might like this function I made then ;)
>
> function createElement($parentNode, $name, $elements=array()) {
> $node = $this->Dom->createElement($name);
> for ($x=0; $x < count($elements); $x++) {
> if ($elements[$x][0] == ".") {
> $node->nodeValue = $elements[$x][1];
> } else {
> $node->setAttribute($elements[$x][0], $elements[$x]
> [1]);
> }
> }
> $parentNode->appendChild($node);
> }
>
> general all purpose element creator for those of us that hate to call
> setAttribute a hundred times ;)
That's pretty slick. I'll have to steal it : )
[Back to original message]
|