Preprocessing using PHP/XML

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


I have an HTML help system that I am generating using the PHP CLI.
Essentially it is a single PHP file that has a few arrays at the top of the
file, before it starts spitting out HTML, like so:

  $strHelpContext = "Shape";

  $arrQuestionHeader = array(
                              "change a shape's properties",
                              "transform a shape",

  $arrQuestionBody = array(
                            "Some html about change a shape's properties
goes here",
                            "Some html about transform a shape goes here",

At the moment I have five PHP files which are identical aside from the
arrays at the top, one for each help topic.  Very inelegant.  I have moved
the contents of all of the arrays from the five files into a nicely
structured XML file.

My question:

What would be the best way to use this XML data to generate 5 seperate HTML

I am using the PHP CLI.  I was thinking maybe I could just pass the CLI the
var $strHelpContext, ie in the example above this is "Shape", and have my
PHP script search through the XML file for the help section with the same
name, then populate the arrays from that.  Is this the best way to do it?
If so, how do I pass the PHP CLI a variable?

"Come to think of it, there are already a million monkeys on a million
typewriters, and the Usenet is NOTHING like Shakespeare!" - Blair Houghton
-=-=-=-=-=-=-=-=-=-=-=- /

Site Timeline