On Monday 19 September 2005 05:27 am, Jasper Bryant-Greene wrote: > Ken Tozier wrote: > > I don't see any obvious DOM method for including scripts or css links > > like "<script language='text/javascript' src='bobo.js'>". Do you have > > to put them in some other type of node like a processing instruction or > > a comment? > > <?php > $dom = new DOMDocument('1.0', 'UTF-8'); > > $script = $dom->createElement('script'); > $script->setAttribute('type', 'text/javascript'); > $script->setAttribute('src', 'bobo.js'); > > $dom->appendChild($script); > ?> I would be extremely careful with this.. because sadly PHP's XML generator uses the short form whenever possible. <script /> will *NOT* work in most browsers such as FireFox. <script></script> Will work. I personally would love to see a function where I could set it to use the long form. and when importing if it's in long form.. set that long from flag on automatically .. this would have saved me _hours_ of debugging work. are you trying to just generate the entire html page using only the XML DOM? .. or are you doing this in conjunction with another language such as XSL? > > Similarly for a link or style element for CSS... > > -- > Jasper Bryant-Greene > Freelance web developer > http://jasper.bryant-greene.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php