I hope someone can steer me in the right direction here!
I'm pretty familiar with XML and I'm just getting comfortable with PHP, however, I'm having a hard time making them work together!
Here's what I'm trying to do:
I have multiple XML files which each contain a question and an answer for a department. I want to keep them separate so that each department can add to their questions/answers as new ones come in.
<?xml version="1.0" ?>
<howdoi>
<questions>
<level1>Benefits</level1>
<level2>Time Off</level2>
<level3>Vacations</level3>
<dept>Human Resources</dept>
<question>
Can I take time off to visit my child's school?
</question>
<answer>
Any employee who is a parent, guardian, or grandparent with custody of a child in kindergarten or grades 1 to 12 is entitled to take up to 40 hours off each school year... blah blah blah
</answer>
</questions>
</howdoi>
What I'm trying to do is create a central help page that will read each of the XML files within a directory and put them into a form where people can select the questions by department and then sub-categories (picture a format like iTunes).
Ideally, this help page will dynamically pull the categories and sublevels (as well as the Q&A) from the XML documents. Each category of each level should be a link that will change the results if someone goes back and selects another category.
So if someone selected Human Resources > Benefits > Time Off > Vacations, they would see something like this:
Department.....................|...Level 1...........|...Level 2.......|...Level 3
--------------------------------|-------------------|------------------|-----------
Administration.................|...<Benefits>.....|...Retirement..|...<Vacations>
<Human Resources>.......|...Job & Pay.......|...<Time Off>..|...Jury Duty
Information Technology...|...Personal Info.|...Healthcare..|...Sick Days
Related Questions:
Can I take time off to visit my child's school?
How many vacation hours do I get a year?
Does my vacation time accrue if I don't use it?
All I can find when I search the forums for XML is how to read just one file:
$xml = simplexml_load_file('path_to_xml_file.xml');
What do I need to do for PHP to read through multiple files and grab the data I need? Can PHP do this with XML?
Thanks!
eCat