You are here: Re: [PHP] Re: Using DOM object, how? « PHP « IT news, forums, messages
Re: [PHP] Re: Using DOM object, how?

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация