PDA

View Full Version : Writing an attribute in 5.2.4 for a newb



fathed
November 9th, 2007, 09:28 AM
I am a newb with PHP, I admit.

I am writing an XML file with PHP from user input forms. I have it writing the file perfectly. What I want to do now is add an attribute to my nodes. How do I write that>

I have tried :


$module = $modules->appendChild($dom->addAttribute('type', 'reprints'));



and it doesn't work.

Everything else is great but this and I can't find anything that works online. Any help would be greatly appreciated.

thank you.

borrob
November 9th, 2007, 10:34 AM
I'm not so into the above code but looked
at it and found it a bit strange:

$dom->addAttribute('type', 'reprints');
returns void if i'm right so you'll get:

$modules->appendChild( );


that couldn't work!
this should be $modules->appendChild( object );