Re: Re: Using DOM object, how?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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 : )

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux