Preprocessing using PHP/XML

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nik Coughin

    #1

    Preprocessing using PHP/XML

    Hi,

    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";

    $arrQuestionHea der = array(
    "change a shape's properties",
    "transform a shape",
    ...etc.
    );

    $arrQuestionBod y = array(
    "Some html about change a shape's properties
    goes here",
    "Some html about transform a shape goes here",
    ...etc.
    );

    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
    files?

    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?

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

    -=-=-=-=-=-=-=-=-=-=-=-


Working...