Multi-Task
June 14th, 2008, 11:16 AM
Greetings been stuck on this for a few weeks now. I am trying to create xml with php and mysql. All data is coming back how I need it I am just having trouble pairing the structure up.
This is what I am after where items are grouped however I am not sure how I can check against either a menu name or other(id) to group similar projects:
XML:
<?xml version="1.0" encoding="UTF-8" ?>
<menu>
<item name="Testing For Menu" action="Testing For Menu" client="Testing For Menu" project="This is a test " >
<sub name="Project Level 2" action="Project Level 2" client="Project Level 2" project="This is project level 2" >
<subsub name="This is file level" action="This is file level" client="This is file level" project="" path="docs/f1.rtf" pid="41" />
<subsub name="This is file level" action="This is file level" client="This is file level" project="" path="docs/f2.rtf" pid="42" />
</sub>
<item name="Testing For Menu 3" action="Testing For Menu 3" client="Testing For Menu 3" project="Testing for menu 3 content" >
<sub name="Project Level 3" action="Project Level 3" client="Project Level 3" project="Project Level 3" >
<subsub name="This is file level 3" action="This is file level 3" client="This is file level 3" project="" path="docs/f3.rtf" pid="43" />
<subsub name="Project Level 3 a" action="Project Level 3 a" client="Project Level 3 a" project="" path="docs/f4" pid="49" />
</sub>
</menu>
This is what I am getting currently where items are all individually written out instead of grouped:
XML:
<?xml version="1.0" encoding="UTF-8" ?>
<menu>
<item name="Testing For Menu" action="Testing For Menu" client="Testing For Menu" project="This is a test " >
<sub name="Project Level 2" action="Project Level 2" client="Project Level 2" project="This is project level 2" >
<subsub name="This is file level" action="This is file level" client="This is file level" project="" path="docs/f1.rtf" pid="41" />
</sub>
</item>
<item name="Testing For Menu" action="Testing For Menu" client="Testing For Menu" project="This is a test " >
<sub name="Project Level 2" action="Project Level 2" client="Project Level 2" project="This is project level 2" >
<subsub name="This is file level" action="This is file level" client="This is file level" project="" path="docs/f2.rtf" pid="42" />
</sub>
</item>
<item name="Testing For Menu 3" action="Testing For Menu 3" client="Testing For Menu 3" project="Testing for menu 3 content" >
<sub name="Project Level 3" action="Project Level 3" client="Project Level 3" project="Project Level 3" >
<subsub name="This is file level 3" action="This is file level 3" client="This is file level 3" project="" path="docs/f3.rtf" pid="43" />
</sub>
</item>
<item name="Testing For Menu 3" action="Testing For Menu 3" client="Testing For Menu 3" project="Testing for menu 3 content" >
<sub name="Project Level 3" action="Project Level 3" client="Project Level 3" project="Project Level 3" >
<subsub name="Project Level 3 a" action="Project Level 3 a" client="Project Level 3 a" project="" path="docs/f4" pid="49" />
</sub>
</item>
</menu>
Attached is my php script I wrote. It works fine however doesnt group. What kind of logic can I use to do this? Should I use a for, while or some other loop to see if same project? Any advice helps. Thanks in advance. MT
This is what I am after where items are grouped however I am not sure how I can check against either a menu name or other(id) to group similar projects:
XML:
<?xml version="1.0" encoding="UTF-8" ?>
<menu>
<item name="Testing For Menu" action="Testing For Menu" client="Testing For Menu" project="This is a test " >
<sub name="Project Level 2" action="Project Level 2" client="Project Level 2" project="This is project level 2" >
<subsub name="This is file level" action="This is file level" client="This is file level" project="" path="docs/f1.rtf" pid="41" />
<subsub name="This is file level" action="This is file level" client="This is file level" project="" path="docs/f2.rtf" pid="42" />
</sub>
<item name="Testing For Menu 3" action="Testing For Menu 3" client="Testing For Menu 3" project="Testing for menu 3 content" >
<sub name="Project Level 3" action="Project Level 3" client="Project Level 3" project="Project Level 3" >
<subsub name="This is file level 3" action="This is file level 3" client="This is file level 3" project="" path="docs/f3.rtf" pid="43" />
<subsub name="Project Level 3 a" action="Project Level 3 a" client="Project Level 3 a" project="" path="docs/f4" pid="49" />
</sub>
</menu>
This is what I am getting currently where items are all individually written out instead of grouped:
XML:
<?xml version="1.0" encoding="UTF-8" ?>
<menu>
<item name="Testing For Menu" action="Testing For Menu" client="Testing For Menu" project="This is a test " >
<sub name="Project Level 2" action="Project Level 2" client="Project Level 2" project="This is project level 2" >
<subsub name="This is file level" action="This is file level" client="This is file level" project="" path="docs/f1.rtf" pid="41" />
</sub>
</item>
<item name="Testing For Menu" action="Testing For Menu" client="Testing For Menu" project="This is a test " >
<sub name="Project Level 2" action="Project Level 2" client="Project Level 2" project="This is project level 2" >
<subsub name="This is file level" action="This is file level" client="This is file level" project="" path="docs/f2.rtf" pid="42" />
</sub>
</item>
<item name="Testing For Menu 3" action="Testing For Menu 3" client="Testing For Menu 3" project="Testing for menu 3 content" >
<sub name="Project Level 3" action="Project Level 3" client="Project Level 3" project="Project Level 3" >
<subsub name="This is file level 3" action="This is file level 3" client="This is file level 3" project="" path="docs/f3.rtf" pid="43" />
</sub>
</item>
<item name="Testing For Menu 3" action="Testing For Menu 3" client="Testing For Menu 3" project="Testing for menu 3 content" >
<sub name="Project Level 3" action="Project Level 3" client="Project Level 3" project="Project Level 3" >
<subsub name="Project Level 3 a" action="Project Level 3 a" client="Project Level 3 a" project="" path="docs/f4" pid="49" />
</sub>
</item>
</menu>
Attached is my php script I wrote. It works fine however doesnt group. What kind of logic can I use to do this? Should I use a for, while or some other loop to see if same project? Any advice helps. Thanks in advance. MT