# Writing XML with PHP

**URL:** <https://forum.kirupa.com/t/writing-xml-with-php/197093>\
**Category:** programming\
**Created:** [August 13, 2006, 8:10pm UTC](https://forum.kirupa.com/t/writing-xml-with-php/197093 "2006-08-13T20:10:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Catalist](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/catalist/32/2148_2.png) [@Catalist](https://forum.kirupa.com/u/Catalist)\
**Post date:** [August 13, 2006, 8:10pm UTC](https://forum.kirupa.com/t/writing-xml-with-php/197093/1 "2006-08-13T20:10:42Z")

</div>

I’ve looked throught some tutorials and have found nothing good on Google or elsewhere.

My problem is that I’m in the prossess of making a full flash site that has a forum, an events page, a members page, etc. And when I want to list the top 3 events I’m using loadVars, which means I have to define numerous variables like title1, event1, etc. after their loaded from my mysql database.

This could be easily simplified if I could load events.php and it had the information displayed as an XML tree and I could use

events = new XML();  
events.load(“events.php”);

But I coulden’t figure out how to quite do that with php’s DOM function. Since it only seems to be able to load an already made XML file and them manipulate it.  
I want to make one and print it depending on my mysql info.

But if I were to just right it out it wouldn’t display the tags like I need for XML.

Does anyone have a good tutorial or know what I need to look at to figure this out.  
Thanks in advance.
